summaryrefslogtreecommitdiffstats
path: root/store
diff options
context:
space:
mode:
author=Corey Hulen <corey@hulen.com>2016-01-20 10:04:17 -0600
committer=Corey Hulen <corey@hulen.com>2016-01-20 10:04:17 -0600
commit11c035aef45fbc6dfbc360123611108a199eca79 (patch)
treee0edabe17ad251a029214ed98a9f7ea66d880a91 /store
parent640d3018c9a75e7c85da55c3483396e31a6de994 (diff)
downloadchat-11c035aef45fbc6dfbc360123611108a199eca79.tar.gz
chat-11c035aef45fbc6dfbc360123611108a199eca79.tar.bz2
chat-11c035aef45fbc6dfbc360123611108a199eca79.zip
PLT-7 adding loc db calls for oauth table
Diffstat (limited to 'store')
-rw-r--r--store/sql_channel_store.go83
-rw-r--r--store/sql_channel_store_test.go199
-rw-r--r--store/sql_post_store_test.go10
-rw-r--r--store/store.go54
4 files changed, 174 insertions, 172 deletions
diff --git a/store/sql_channel_store.go b/store/sql_channel_store.go
index 4585647de..d85969b21 100644
--- a/store/sql_channel_store.go
+++ b/store/sql_channel_store.go
@@ -7,6 +7,7 @@ import (
"github.com/go-gorp/gorp"
"github.com/mattermost/platform/model"
"github.com/mattermost/platform/utils"
+ goi18n "github.com/nicksnyder/go-i18n/i18n"
)
type SqlChannelStore struct {
@@ -49,7 +50,7 @@ func (s SqlChannelStore) CreateIndexesIfNotExists() {
s.CreateIndexIfNotExists("idx_channelmembers_user_id", "ChannelMembers", "UserId")
}
-func (s SqlChannelStore) Save(channel *model.Channel) StoreChannel {
+func (s SqlChannelStore) Save(T goi18n.TranslateFunc, channel *model.Channel) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -60,7 +61,7 @@ func (s SqlChannelStore) Save(channel *model.Channel) StoreChannel {
if transaction, err := s.GetMaster().Begin(); err != nil {
result.Err = model.NewAppError("SqlChannelStore.Save", "Unable to open transaction", err.Error())
} else {
- result = s.saveChannelT(transaction, channel)
+ result = s.saveChannelT(T, transaction, channel)
if result.Err != nil {
transaction.Rollback()
} else {
@@ -78,7 +79,7 @@ func (s SqlChannelStore) Save(channel *model.Channel) StoreChannel {
return storeChannel
}
-func (s SqlChannelStore) SaveDirectChannel(directchannel *model.Channel, member1 *model.ChannelMember, member2 *model.ChannelMember) StoreChannel {
+func (s SqlChannelStore) SaveDirectChannel(T goi18n.TranslateFunc, directchannel *model.Channel, member1 *model.ChannelMember, member2 *model.ChannelMember) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -90,7 +91,7 @@ func (s SqlChannelStore) SaveDirectChannel(directchannel *model.Channel, member1
if transaction, err := s.GetMaster().Begin(); err != nil {
result.Err = model.NewAppError("SqlChannelStore.SaveDirectChannel", "Unable to open transaction", err.Error())
} else {
- channelResult := s.saveChannelT(transaction, directchannel)
+ channelResult := s.saveChannelT(T, transaction, directchannel)
if channelResult.Err != nil {
transaction.Rollback()
@@ -101,8 +102,8 @@ func (s SqlChannelStore) SaveDirectChannel(directchannel *model.Channel, member1
member1.ChannelId = newChannel.Id
member2.ChannelId = newChannel.Id
- member1Result := s.saveMemberT(transaction, member1, newChannel)
- member2Result := s.saveMemberT(transaction, member2, newChannel)
+ member1Result := s.saveMemberT(T, transaction, member1, newChannel)
+ member2Result := s.saveMemberT(T, transaction, member2, newChannel)
if member1Result.Err != nil || member2Result.Err != nil {
transaction.Rollback()
@@ -132,7 +133,7 @@ func (s SqlChannelStore) SaveDirectChannel(directchannel *model.Channel, member1
return storeChannel
}
-func (s SqlChannelStore) saveChannelT(transaction *gorp.Transaction, channel *model.Channel) StoreResult {
+func (s SqlChannelStore) saveChannelT(T goi18n.TranslateFunc, transaction *gorp.Transaction, channel *model.Channel) StoreResult {
result := StoreResult{}
if len(channel.Id) > 0 {
@@ -174,7 +175,7 @@ func (s SqlChannelStore) saveChannelT(transaction *gorp.Transaction, channel *mo
return result
}
-func (s SqlChannelStore) Update(channel *model.Channel) StoreChannel {
+func (s SqlChannelStore) Update(T goi18n.TranslateFunc, channel *model.Channel) StoreChannel {
storeChannel := make(StoreChannel)
@@ -214,7 +215,7 @@ func (s SqlChannelStore) Update(channel *model.Channel) StoreChannel {
return storeChannel
}
-func (s SqlChannelStore) extraUpdated(channel *model.Channel) StoreChannel {
+func (s SqlChannelStore) extraUpdated(T goi18n.TranslateFunc, channel *model.Channel) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -242,15 +243,15 @@ func (s SqlChannelStore) extraUpdated(channel *model.Channel) StoreChannel {
return storeChannel
}
-func (s SqlChannelStore) Get(id string) StoreChannel {
- return s.get(id, false)
+func (s SqlChannelStore) Get(T goi18n.TranslateFunc, id string) StoreChannel {
+ return s.get(T, id, false)
}
-func (s SqlChannelStore) GetFromMaster(id string) StoreChannel {
- return s.get(id, true)
+func (s SqlChannelStore) GetFromMaster(T goi18n.TranslateFunc, id string) StoreChannel {
+ return s.get(T, id, true)
}
-func (s SqlChannelStore) get(id string, master bool) StoreChannel {
+func (s SqlChannelStore) get(T goi18n.TranslateFunc, id string, master bool) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -278,7 +279,7 @@ func (s SqlChannelStore) get(id string, master bool) StoreChannel {
return storeChannel
}
-func (s SqlChannelStore) Delete(channelId string, time int64) StoreChannel {
+func (s SqlChannelStore) Delete(T goi18n.TranslateFunc, channelId string, time int64) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -296,7 +297,7 @@ func (s SqlChannelStore) Delete(channelId string, time int64) StoreChannel {
return storeChannel
}
-func (s SqlChannelStore) PermanentDeleteByTeam(teamId string) StoreChannel {
+func (s SqlChannelStore) PermanentDeleteByTeam(T goi18n.TranslateFunc, teamId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -318,7 +319,7 @@ type channelWithMember struct {
model.ChannelMember
}
-func (s SqlChannelStore) GetChannels(teamId string, userId string) StoreChannel {
+func (s SqlChannelStore) GetChannels(T goi18n.TranslateFunc, teamId string, userId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -351,7 +352,7 @@ func (s SqlChannelStore) GetChannels(teamId string, userId string) StoreChannel
return storeChannel
}
-func (s SqlChannelStore) GetMoreChannels(teamId string, userId string) StoreChannel {
+func (s SqlChannelStore) GetMoreChannels(T goi18n.TranslateFunc, teamId string, userId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -399,7 +400,7 @@ type channelIdWithCountAndUpdateAt struct {
UpdateAt int64
}
-func (s SqlChannelStore) GetChannelCounts(teamId string, userId string) StoreChannel {
+func (s SqlChannelStore) GetChannelCounts(T goi18n.TranslateFunc, teamId string, userId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -428,7 +429,7 @@ func (s SqlChannelStore) GetChannelCounts(teamId string, userId string) StoreCha
return storeChannel
}
-func (s SqlChannelStore) GetByName(teamId string, name string) StoreChannel {
+func (s SqlChannelStore) GetByName(T goi18n.TranslateFunc, teamId string, name string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -449,13 +450,13 @@ func (s SqlChannelStore) GetByName(teamId string, name string) StoreChannel {
return storeChannel
}
-func (s SqlChannelStore) SaveMember(member *model.ChannelMember) StoreChannel {
+func (s SqlChannelStore) SaveMember(T goi18n.TranslateFunc, member *model.ChannelMember) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
var result StoreResult
// Grab the channel we are saving this member to
- if cr := <-s.GetFromMaster(member.ChannelId); cr.Err != nil {
+ if cr := <-s.GetFromMaster(T, member.ChannelId); cr.Err != nil {
result.Err = cr.Err
} else {
channel := cr.Data.(*model.Channel)
@@ -463,7 +464,7 @@ func (s SqlChannelStore) SaveMember(member *model.ChannelMember) StoreChannel {
if transaction, err := s.GetMaster().Begin(); err != nil {
result.Err = model.NewAppError("SqlChannelStore.SaveMember", "Unable to open transaction", err.Error())
} else {
- result = s.saveMemberT(transaction, member, channel)
+ result = s.saveMemberT(T, transaction, member, channel)
if result.Err != nil {
transaction.Rollback()
} else {
@@ -471,7 +472,7 @@ func (s SqlChannelStore) SaveMember(member *model.ChannelMember) StoreChannel {
result.Err = model.NewAppError("SqlChannelStore.SaveMember", "Unable to commit transaction", err.Error())
}
// If sucessfull record members have changed in channel
- if mu := <-s.extraUpdated(channel); mu.Err != nil {
+ if mu := <-s.extraUpdated(T, channel); mu.Err != nil {
result.Err = mu.Err
}
}
@@ -485,7 +486,7 @@ func (s SqlChannelStore) SaveMember(member *model.ChannelMember) StoreChannel {
return storeChannel
}
-func (s SqlChannelStore) saveMemberT(transaction *gorp.Transaction, member *model.ChannelMember, channel *model.Channel) StoreResult {
+func (s SqlChannelStore) saveMemberT(T goi18n.TranslateFunc, transaction *gorp.Transaction, member *model.ChannelMember, channel *model.Channel) StoreResult {
result := StoreResult{}
member.PreSave()
@@ -506,7 +507,7 @@ func (s SqlChannelStore) saveMemberT(transaction *gorp.Transaction, member *mode
return result
}
-func (s SqlChannelStore) UpdateMember(member *model.ChannelMember) StoreChannel {
+func (s SqlChannelStore) UpdateMember(T goi18n.TranslateFunc, member *model.ChannelMember) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -534,7 +535,7 @@ func (s SqlChannelStore) UpdateMember(member *model.ChannelMember) StoreChannel
return storeChannel
}
-func (s SqlChannelStore) GetMembers(channelId string) StoreChannel {
+func (s SqlChannelStore) GetMembers(T goi18n.TranslateFunc, channelId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -555,7 +556,7 @@ func (s SqlChannelStore) GetMembers(channelId string) StoreChannel {
return storeChannel
}
-func (s SqlChannelStore) GetMember(channelId string, userId string) StoreChannel {
+func (s SqlChannelStore) GetMember(T goi18n.TranslateFunc, channelId string, userId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -576,7 +577,7 @@ func (s SqlChannelStore) GetMember(channelId string, userId string) StoreChannel
return storeChannel
}
-func (s SqlChannelStore) GetMemberCount(channelId string) StoreChannel {
+func (s SqlChannelStore) GetMemberCount(T goi18n.TranslateFunc, channelId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -596,7 +597,7 @@ func (s SqlChannelStore) GetMemberCount(channelId string) StoreChannel {
return storeChannel
}
-func (s SqlChannelStore) GetExtraMembers(channelId string, limit int) StoreChannel {
+func (s SqlChannelStore) GetExtraMembers(T goi18n.TranslateFunc, channelId string, limit int) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -627,14 +628,14 @@ func (s SqlChannelStore) GetExtraMembers(channelId string, limit int) StoreChann
return storeChannel
}
-func (s SqlChannelStore) RemoveMember(channelId string, userId string) StoreChannel {
+func (s SqlChannelStore) RemoveMember(T goi18n.TranslateFunc, channelId string, userId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
result := StoreResult{}
// Grab the channel we are saving this member to
- if cr := <-s.Get(channelId); cr.Err != nil {
+ if cr := <-s.Get(T, channelId); cr.Err != nil {
result.Err = cr.Err
} else {
channel := cr.Data.(*model.Channel)
@@ -644,7 +645,7 @@ func (s SqlChannelStore) RemoveMember(channelId string, userId string) StoreChan
result.Err = model.NewAppError("SqlChannelStore.RemoveMember", "We couldn't remove the channel member", "channel_id="+channelId+", user_id="+userId+", "+err.Error())
} else {
// If sucessfull record members have changed in channel
- if mu := <-s.extraUpdated(channel); mu.Err != nil {
+ if mu := <-s.extraUpdated(T, channel); mu.Err != nil {
result.Err = mu.Err
}
}
@@ -657,7 +658,7 @@ func (s SqlChannelStore) RemoveMember(channelId string, userId string) StoreChan
return storeChannel
}
-func (s SqlChannelStore) PermanentDeleteMembersByUser(userId string) StoreChannel {
+func (s SqlChannelStore) PermanentDeleteMembersByUser(T goi18n.TranslateFunc, userId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -674,7 +675,7 @@ func (s SqlChannelStore) PermanentDeleteMembersByUser(userId string) StoreChanne
return storeChannel
}
-func (s SqlChannelStore) CheckPermissionsTo(teamId string, channelId string, userId string) StoreChannel {
+func (s SqlChannelStore) CheckPermissionsTo(T goi18n.TranslateFunc, teamId string, channelId string, userId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -706,7 +707,7 @@ func (s SqlChannelStore) CheckPermissionsTo(teamId string, channelId string, use
return storeChannel
}
-func (s SqlChannelStore) CheckPermissionsToByName(teamId string, channelName string, userId string) StoreChannel {
+func (s SqlChannelStore) CheckPermissionsToByName(T goi18n.TranslateFunc, teamId string, channelName string, userId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -738,7 +739,7 @@ func (s SqlChannelStore) CheckPermissionsToByName(teamId string, channelName str
return storeChannel
}
-func (s SqlChannelStore) CheckOpenChannelPermissions(teamId string, channelId string) StoreChannel {
+func (s SqlChannelStore) CheckOpenChannelPermissions(T goi18n.TranslateFunc, teamId string, channelId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -767,7 +768,7 @@ func (s SqlChannelStore) CheckOpenChannelPermissions(teamId string, channelId st
return storeChannel
}
-func (s SqlChannelStore) UpdateLastViewedAt(channelId string, userId string) StoreChannel {
+func (s SqlChannelStore) UpdateLastViewedAt(T goi18n.TranslateFunc, channelId string, userId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -815,7 +816,7 @@ func (s SqlChannelStore) UpdateLastViewedAt(channelId string, userId string) Sto
return storeChannel
}
-func (s SqlChannelStore) IncrementMentionCount(channelId string, userId string) StoreChannel {
+func (s SqlChannelStore) IncrementMentionCount(T goi18n.TranslateFunc, channelId string, userId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -841,7 +842,7 @@ func (s SqlChannelStore) IncrementMentionCount(channelId string, userId string)
return storeChannel
}
-func (s SqlChannelStore) GetForExport(teamId string) StoreChannel {
+func (s SqlChannelStore) GetForExport(T goi18n.TranslateFunc, teamId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -863,7 +864,7 @@ func (s SqlChannelStore) GetForExport(teamId string) StoreChannel {
return storeChannel
}
-func (s SqlChannelStore) AnalyticsTypeCount(teamId string, channelType string) StoreChannel {
+func (s SqlChannelStore) AnalyticsTypeCount(T goi18n.TranslateFunc, teamId string, channelType string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
diff --git a/store/sql_channel_store_test.go b/store/sql_channel_store_test.go
index 8b22fbb7a..412b03b10 100644
--- a/store/sql_channel_store_test.go
+++ b/store/sql_channel_store_test.go
@@ -5,6 +5,7 @@ package store
import (
"github.com/mattermost/platform/model"
+ "github.com/mattermost/platform/utils"
"testing"
"time"
)
@@ -20,23 +21,23 @@ func TestChannelStoreSave(t *testing.T) {
o1.Name = "a" + model.NewId() + "b"
o1.Type = model.CHANNEL_OPEN
- if err := (<-store.Channel().Save(&o1)).Err; err != nil {
+ if err := (<-store.Channel().Save(utils.T, &o1)).Err; err != nil {
t.Fatal("couldn't save item", err)
}
- if err := (<-store.Channel().Save(&o1)).Err; err == nil {
+ if err := (<-store.Channel().Save(utils.T, &o1)).Err; err == nil {
t.Fatal("shouldn't be able to update from save")
}
o1.Id = ""
- if err := (<-store.Channel().Save(&o1)).Err; err == nil {
+ if err := (<-store.Channel().Save(utils.T, &o1)).Err; err == nil {
t.Fatal("should be unique name")
}
o1.Id = ""
o1.Name = "a" + model.NewId() + "b"
o1.Type = model.CHANNEL_DIRECT
- if err := (<-store.Channel().Save(&o1)).Err; err == nil {
+ if err := (<-store.Channel().Save(utils.T, &o1)).Err; err == nil {
t.Fatal("Should not be able to save direct channel")
}
@@ -44,14 +45,14 @@ func TestChannelStoreSave(t *testing.T) {
for i := 0; i < 1000; i++ {
o1.Id = ""
o1.Name = "a" + model.NewId() + "b"
- if err := (<-store.Channel().Save(&o1)).Err; err != nil {
+ if err := (<-store.Channel().Save(utils.T, &o1)).Err; err != nil {
t.Fatal("couldn't save item", err)
}
}
o1.Id = ""
o1.Name = "a" + model.NewId() + "b"
- if err := (<-store.Channel().Save(&o1)).Err; err == nil {
+ if err := (<-store.Channel().Save(utils.T, &o1)).Err; err == nil {
t.Fatal("should be the limit")
}
}
@@ -89,23 +90,23 @@ func TestChannelStoreSaveDirectChannel(t *testing.T) {
m2.UserId = u2.Id
m2.NotifyProps = model.GetDefaultChannelNotifyProps()
- if err := (<-store.Channel().SaveDirectChannel(&o1, &m1, &m2)).Err; err != nil {
+ if err := (<-store.Channel().SaveDirectChannel(utils.T, &o1, &m1, &m2)).Err; err != nil {
t.Fatal("couldn't save direct channel", err)
}
- members := (<-store.Channel().GetMembers(o1.Id)).Data.([]model.ChannelMember)
+ members := (<-store.Channel().GetMembers(utils.T, o1.Id)).Data.([]model.ChannelMember)
if len(members) != 2 {
t.Fatal("should have saved 2 members")
}
- if err := (<-store.Channel().SaveDirectChannel(&o1, &m1, &m2)).Err; err == nil {
+ if err := (<-store.Channel().SaveDirectChannel(utils.T, &o1, &m1, &m2)).Err; err == nil {
t.Fatal("shouldn't be able to update from save")
}
o1.Id = ""
o1.Name = "a" + model.NewId() + "b"
o1.Type = model.CHANNEL_OPEN
- if err := (<-store.Channel().SaveDirectChannel(&o1, &m1, &m2)).Err; err == nil {
+ if err := (<-store.Channel().SaveDirectChannel(utils.T, &o1, &m1, &m2)).Err; err == nil {
t.Fatal("Should not be able to save non-direct channel")
}
@@ -120,23 +121,23 @@ func TestChannelStoreUpdate(t *testing.T) {
o1.Name = "a" + model.NewId() + "b"
o1.Type = model.CHANNEL_OPEN
- if err := (<-store.Channel().Save(&o1)).Err; err != nil {
+ if err := (<-store.Channel().Save(utils.T, &o1)).Err; err != nil {
t.Fatal(err)
}
time.Sleep(100 * time.Millisecond)
- if err := (<-store.Channel().Update(&o1)).Err; err != nil {
+ if err := (<-store.Channel().Update(utils.T, &o1)).Err; err != nil {
t.Fatal(err)
}
o1.Id = "missing"
- if err := (<-store.Channel().Update(&o1)).Err; err == nil {
+ if err := (<-store.Channel().Update(utils.T, &o1)).Err; err == nil {
t.Fatal("Update should have failed because of missing key")
}
o1.Id = model.NewId()
- if err := (<-store.Channel().Update(&o1)).Err; err == nil {
+ if err := (<-store.Channel().Update(utils.T, &o1)).Err; err == nil {
t.Fatal("Update should have faile because id change")
}
}
@@ -149,9 +150,9 @@ func TestChannelStoreGet(t *testing.T) {
o1.DisplayName = "Name"
o1.Name = "a" + model.NewId() + "b"
o1.Type = model.CHANNEL_OPEN
- Must(store.Channel().Save(&o1))
+ Must(store.Channel().Save(utils.T, &o1))
- if r1 := <-store.Channel().Get(o1.Id); r1.Err != nil {
+ if r1 := <-store.Channel().Get(utils.T, o1.Id); r1.Err != nil {
t.Fatal(r1.Err)
} else {
if r1.Data.(*model.Channel).ToJson() != o1.ToJson() {
@@ -159,7 +160,7 @@ func TestChannelStoreGet(t *testing.T) {
}
}
- if err := (<-store.Channel().Get("")).Err; err == nil {
+ if err := (<-store.Channel().Get(utils.T, "")).Err; err == nil {
t.Fatal("Missing id should have failed")
}
@@ -191,9 +192,9 @@ func TestChannelStoreGet(t *testing.T) {
m2.UserId = u2.Id
m2.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveDirectChannel(&o2, &m1, &m2))
+ Must(store.Channel().SaveDirectChannel(utils.T, &o2, &m1, &m2))
- if r2 := <-store.Channel().Get(o2.Id); r2.Err != nil {
+ if r2 := <-store.Channel().Get(utils.T, o2.Id); r2.Err != nil {
t.Fatal(r2.Err)
} else {
if r2.Data.(*model.Channel).ToJson() != o2.ToJson() {
@@ -210,61 +211,61 @@ func TestChannelStoreDelete(t *testing.T) {
o1.DisplayName = "Channel1"
o1.Name = "a" + model.NewId() + "b"
o1.Type = model.CHANNEL_OPEN
- Must(store.Channel().Save(&o1))
+ Must(store.Channel().Save(utils.T, &o1))
o2 := model.Channel{}
o2.TeamId = o1.TeamId
o2.DisplayName = "Channel2"
o2.Name = "a" + model.NewId() + "b"
o2.Type = model.CHANNEL_OPEN
- Must(store.Channel().Save(&o2))
+ Must(store.Channel().Save(utils.T, &o2))
o3 := model.Channel{}
o3.TeamId = o1.TeamId
o3.DisplayName = "Channel3"
o3.Name = "a" + model.NewId() + "b"
o3.Type = model.CHANNEL_OPEN
- Must(store.Channel().Save(&o3))
+ Must(store.Channel().Save(utils.T, &o3))
o4 := model.Channel{}
o4.TeamId = o1.TeamId
o4.DisplayName = "Channel4"
o4.Name = "a" + model.NewId() + "b"
o4.Type = model.CHANNEL_OPEN
- Must(store.Channel().Save(&o4))
+ Must(store.Channel().Save(utils.T, &o4))
m1 := model.ChannelMember{}
m1.ChannelId = o1.Id
m1.UserId = model.NewId()
m1.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(&m1))
+ Must(store.Channel().SaveMember(utils.T, &m1))
m2 := model.ChannelMember{}
m2.ChannelId = o2.Id
m2.UserId = m1.UserId
m2.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(&m2))
+ Must(store.Channel().SaveMember(utils.T, &m2))
- if r := <-store.Channel().Delete(o1.Id, model.GetMillis()); r.Err != nil {
+ if r := <-store.Channel().Delete(utils.T, o1.Id, model.GetMillis()); r.Err != nil {
t.Fatal(r.Err)
}
- if r := <-store.Channel().Get(o1.Id); r.Data.(*model.Channel).DeleteAt == 0 {
+ if r := <-store.Channel().Get(utils.T, o1.Id); r.Data.(*model.Channel).DeleteAt == 0 {
t.Fatal("should have been deleted")
}
- if r := <-store.Channel().Delete(o3.Id, model.GetMillis()); r.Err != nil {
+ if r := <-store.Channel().Delete(utils.T, o3.Id, model.GetMillis()); r.Err != nil {
t.Fatal(r.Err)
}
- cresult := <-store.Channel().GetChannels(o1.TeamId, m1.UserId)
+ cresult := <-store.Channel().GetChannels(utils.T, o1.TeamId, m1.UserId)
list := cresult.Data.(*model.ChannelList)
if len(list.Channels) != 1 {
t.Fatal("invalid number of channels")
}
- cresult = <-store.Channel().GetMoreChannels(o1.TeamId, m1.UserId)
+ cresult = <-store.Channel().GetMoreChannels(utils.T, o1.TeamId, m1.UserId)
list = cresult.Data.(*model.ChannelList)
if len(list.Channels) != 1 {
@@ -280,9 +281,9 @@ func TestChannelStoreGetByName(t *testing.T) {
o1.DisplayName = "Name"
o1.Name = "a" + model.NewId() + "b"
o1.Type = model.CHANNEL_OPEN
- Must(store.Channel().Save(&o1))
+ Must(store.Channel().Save(utils.T, &o1))
- if r1 := <-store.Channel().GetByName(o1.TeamId, o1.Name); r1.Err != nil {
+ if r1 := <-store.Channel().GetByName(utils.T, o1.TeamId, o1.Name); r1.Err != nil {
t.Fatal(r1.Err)
} else {
if r1.Data.(*model.Channel).ToJson() != o1.ToJson() {
@@ -290,7 +291,7 @@ func TestChannelStoreGetByName(t *testing.T) {
}
}
- if err := (<-store.Channel().GetByName(o1.TeamId, "")).Err; err == nil {
+ if err := (<-store.Channel().GetByName(utils.T, o1.TeamId, "")).Err; err == nil {
t.Fatal("Missing id should have failed")
}
}
@@ -303,9 +304,9 @@ func TestChannelMemberStore(t *testing.T) {
c1.DisplayName = "NameName"
c1.Name = "a" + model.NewId() + "b"
c1.Type = model.CHANNEL_OPEN
- c1 = *Must(store.Channel().Save(&c1)).(*model.Channel)
+ c1 = *Must(store.Channel().Save(utils.T, &c1)).(*model.Channel)
- c1t1 := (<-store.Channel().Get(c1.Id)).Data.(*model.Channel)
+ c1t1 := (<-store.Channel().Get(utils.T, c1.Id)).Data.(*model.Channel)
t1 := c1t1.ExtraUpdateAt
u1 := model.User{}
@@ -324,55 +325,55 @@ func TestChannelMemberStore(t *testing.T) {
o1.ChannelId = c1.Id
o1.UserId = u1.Id
o1.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(&o1))
+ Must(store.Channel().SaveMember(utils.T, &o1))
o2 := model.ChannelMember{}
o2.ChannelId = c1.Id
o2.UserId = u2.Id
o2.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(&o2))
+ Must(store.Channel().SaveMember(utils.T, &o2))
- c1t2 := (<-store.Channel().Get(c1.Id)).Data.(*model.Channel)
+ c1t2 := (<-store.Channel().Get(utils.T, c1.Id)).Data.(*model.Channel)
t2 := c1t2.ExtraUpdateAt
if t2 <= t1 {
t.Fatal("Member update time incorrect")
}
- count := (<-store.Channel().GetMemberCount(o1.ChannelId)).Data.(int64)
+ count := (<-store.Channel().GetMemberCount(utils.T, o1.ChannelId)).Data.(int64)
if count != 2 {
t.Fatal("should have saved 2 members")
}
- Must(store.Channel().RemoveMember(o2.ChannelId, o2.UserId))
+ Must(store.Channel().RemoveMember(utils.T, o2.ChannelId, o2.UserId))
- count = (<-store.Channel().GetMemberCount(o1.ChannelId)).Data.(int64)
+ count = (<-store.Channel().GetMemberCount(utils.T, o1.ChannelId)).Data.(int64)
if count != 1 {
t.Fatal("should have removed 1 member")
}
- c1t3 := (<-store.Channel().Get(c1.Id)).Data.(*model.Channel)
+ c1t3 := (<-store.Channel().Get(utils.T, c1.Id)).Data.(*model.Channel)
t3 := c1t3.ExtraUpdateAt
if t3 <= t2 || t3 <= t1 {
t.Fatal("Member update time incorrect on delete")
}
- member := (<-store.Channel().GetMember(o1.ChannelId, o1.UserId)).Data.(model.ChannelMember)
+ member := (<-store.Channel().GetMember(utils.T, o1.ChannelId, o1.UserId)).Data.(model.ChannelMember)
if member.ChannelId != o1.ChannelId {
t.Fatal("should have go member")
}
- extraMembers := (<-store.Channel().GetExtraMembers(o1.ChannelId, 20)).Data.([]model.ExtraMember)
+ extraMembers := (<-store.Channel().GetExtraMembers(utils.T, o1.ChannelId, 20)).Data.([]model.ExtraMember)
if len(extraMembers) != 1 {
t.Fatal("should have 1 extra members")
}
- if err := (<-store.Channel().SaveMember(&o1)).Err; err == nil {
+ if err := (<-store.Channel().SaveMember(utils.T, &o1)).Err; err == nil {
t.Fatal("Should have been a duplicate")
}
- c1t4 := (<-store.Channel().Get(c1.Id)).Data.(*model.Channel)
+ c1t4 := (<-store.Channel().Get(utils.T, c1.Id)).Data.(*model.Channel)
t4 := c1t4.ExtraUpdateAt
if t4 != t3 {
t.Fatal("Should not update time upon failure")
@@ -387,9 +388,9 @@ func TestChannelDeleteMemberStore(t *testing.T) {
c1.DisplayName = "NameName"
c1.Name = "a" + model.NewId() + "b"
c1.Type = model.CHANNEL_OPEN
- c1 = *Must(store.Channel().Save(&c1)).(*model.Channel)
+ c1 = *Must(store.Channel().Save(utils.T, &c1)).(*model.Channel)
- c1t1 := (<-store.Channel().Get(c1.Id)).Data.(*model.Channel)
+ c1t1 := (<-store.Channel().Get(utils.T, c1.Id)).Data.(*model.Channel)
t1 := c1t1.ExtraUpdateAt
u1 := model.User{}
@@ -408,29 +409,29 @@ func TestChannelDeleteMemberStore(t *testing.T) {
o1.ChannelId = c1.Id
o1.UserId = u1.Id
o1.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(&o1))
+ Must(store.Channel().SaveMember(utils.T, &o1))
o2 := model.ChannelMember{}
o2.ChannelId = c1.Id
o2.UserId = u2.Id
o2.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(&o2))
+ Must(store.Channel().SaveMember(utils.T, &o2))
- c1t2 := (<-store.Channel().Get(c1.Id)).Data.(*model.Channel)
+ c1t2 := (<-store.Channel().Get(utils.T, c1.Id)).Data.(*model.Channel)
t2 := c1t2.ExtraUpdateAt
if t2 <= t1 {
t.Fatal("Member update time incorrect")
}
- count := (<-store.Channel().GetMemberCount(o1.ChannelId)).Data.(int64)
+ count := (<-store.Channel().GetMemberCount(utils.T, o1.ChannelId)).Data.(int64)
if count != 2 {
t.Fatal("should have saved 2 members")
}
- Must(store.Channel().PermanentDeleteMembersByUser(o2.UserId))
+ Must(store.Channel().PermanentDeleteMembersByUser(utils.T, o2.UserId))
- count = (<-store.Channel().GetMemberCount(o1.ChannelId)).Data.(int64)
+ count = (<-store.Channel().GetMemberCount(utils.T, o1.ChannelId)).Data.(int64)
if count != 1 {
t.Fatal("should have removed 1 member")
}
@@ -444,40 +445,40 @@ func TestChannelStorePermissionsTo(t *testing.T) {
o1.DisplayName = "Channel1"
o1.Name = "a" + model.NewId() + "b"
o1.Type = model.CHANNEL_OPEN
- Must(store.Channel().Save(&o1))
+ Must(store.Channel().Save(utils.T, &o1))
m1 := model.ChannelMember{}
m1.ChannelId = o1.Id
m1.UserId = model.NewId()
m1.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(&m1))
+ Must(store.Channel().SaveMember(utils.T, &m1))
- count := (<-store.Channel().CheckPermissionsTo(o1.TeamId, o1.Id, m1.UserId)).Data.(int64)
+ count := (<-store.Channel().CheckPermissionsTo(utils.T, o1.TeamId, o1.Id, m1.UserId)).Data.(int64)
if count != 1 {
t.Fatal("should have permissions")
}
- count = (<-store.Channel().CheckPermissionsTo("junk", o1.Id, m1.UserId)).Data.(int64)
+ count = (<-store.Channel().CheckPermissionsTo(utils.T, "junk", o1.Id, m1.UserId)).Data.(int64)
if count != 0 {
t.Fatal("shouldn't have permissions")
}
- count = (<-store.Channel().CheckPermissionsTo(o1.TeamId, "junk", m1.UserId)).Data.(int64)
+ count = (<-store.Channel().CheckPermissionsTo(utils.T, o1.TeamId, "junk", m1.UserId)).Data.(int64)
if count != 0 {
t.Fatal("shouldn't have permissions")
}
- count = (<-store.Channel().CheckPermissionsTo(o1.TeamId, o1.Id, "junk")).Data.(int64)
+ count = (<-store.Channel().CheckPermissionsTo(utils.T, o1.TeamId, o1.Id, "junk")).Data.(int64)
if count != 0 {
t.Fatal("shouldn't have permissions")
}
- channelId := (<-store.Channel().CheckPermissionsToByName(o1.TeamId, o1.Name, m1.UserId)).Data.(string)
+ channelId := (<-store.Channel().CheckPermissionsToByName(utils.T, o1.TeamId, o1.Name, m1.UserId)).Data.(string)
if channelId != o1.Id {
t.Fatal("should have permissions")
}
- channelId = (<-store.Channel().CheckPermissionsToByName(o1.TeamId, "missing", m1.UserId)).Data.(string)
+ channelId = (<-store.Channel().CheckPermissionsToByName(utils.T, o1.TeamId, "missing", m1.UserId)).Data.(string)
if channelId != "" {
t.Fatal("should not have permissions")
}
@@ -491,19 +492,19 @@ func TestChannelStoreOpenChannelPermissionsTo(t *testing.T) {
o1.DisplayName = "Channel1"
o1.Name = "a" + model.NewId() + "b"
o1.Type = model.CHANNEL_OPEN
- Must(store.Channel().Save(&o1))
+ Must(store.Channel().Save(utils.T, &o1))
- count := (<-store.Channel().CheckOpenChannelPermissions(o1.TeamId, o1.Id)).Data.(int64)
+ count := (<-store.Channel().CheckOpenChannelPermissions(utils.T, o1.TeamId, o1.Id)).Data.(int64)
if count != 1 {
t.Fatal("should have permissions")
}
- count = (<-store.Channel().CheckOpenChannelPermissions("junk", o1.Id)).Data.(int64)
+ count = (<-store.Channel().CheckOpenChannelPermissions(utils.T, "junk", o1.Id)).Data.(int64)
if count != 0 {
t.Fatal("shouldn't have permissions")
}
- count = (<-store.Channel().CheckOpenChannelPermissions(o1.TeamId, "junk")).Data.(int64)
+ count = (<-store.Channel().CheckOpenChannelPermissions(utils.T, o1.TeamId, "junk")).Data.(int64)
if count != 0 {
t.Fatal("shouldn't have permissions")
}
@@ -517,34 +518,34 @@ func TestChannelStoreGetChannels(t *testing.T) {
o2.DisplayName = "Channel2"
o2.Name = "a" + model.NewId() + "b"
o2.Type = model.CHANNEL_OPEN
- Must(store.Channel().Save(&o2))
+ Must(store.Channel().Save(utils.T, &o2))
o1 := model.Channel{}
o1.TeamId = model.NewId()
o1.DisplayName = "Channel1"
o1.Name = "a" + model.NewId() + "b"
o1.Type = model.CHANNEL_OPEN
- Must(store.Channel().Save(&o1))
+ Must(store.Channel().Save(utils.T, &o1))
m1 := model.ChannelMember{}
m1.ChannelId = o1.Id
m1.UserId = model.NewId()
m1.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(&m1))
+ Must(store.Channel().SaveMember(utils.T, &m1))
m2 := model.ChannelMember{}
m2.ChannelId = o1.Id
m2.UserId = model.NewId()
m2.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(&m2))
+ Must(store.Channel().SaveMember(utils.T, &m2))
m3 := model.ChannelMember{}
m3.ChannelId = o2.Id
m3.UserId = model.NewId()
m3.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(&m3))
+ Must(store.Channel().SaveMember(utils.T, &m3))
- cresult := <-store.Channel().GetChannels(o1.TeamId, m1.UserId)
+ cresult := <-store.Channel().GetChannels(utils.T, o1.TeamId, m1.UserId)
list := cresult.Data.(*model.ChannelList)
if list.Channels[0].Id != o1.Id {
@@ -560,55 +561,55 @@ func TestChannelStoreGetMoreChannels(t *testing.T) {
o1.DisplayName = "Channel1"
o1.Name = "a" + model.NewId() + "b"
o1.Type = model.CHANNEL_OPEN
- Must(store.Channel().Save(&o1))
+ Must(store.Channel().Save(utils.T, &o1))
o2 := model.Channel{}
o2.TeamId = model.NewId()
o2.DisplayName = "Channel2"
o2.Name = "a" + model.NewId() + "b"
o2.Type = model.CHANNEL_OPEN
- Must(store.Channel().Save(&o2))
+ Must(store.Channel().Save(utils.T, &o2))
m1 := model.ChannelMember{}
m1.ChannelId = o1.Id
m1.UserId = model.NewId()
m1.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(&m1))
+ Must(store.Channel().SaveMember(utils.T, &m1))
m2 := model.ChannelMember{}
m2.ChannelId = o1.Id
m2.UserId = model.NewId()
m2.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(&m2))
+ Must(store.Channel().SaveMember(utils.T, &m2))
m3 := model.ChannelMember{}
m3.ChannelId = o2.Id
m3.UserId = model.NewId()
m3.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(&m3))
+ Must(store.Channel().SaveMember(utils.T, &m3))
o3 := model.Channel{}
o3.TeamId = o1.TeamId
o3.DisplayName = "ChannelA"
o3.Name = "a" + model.NewId() + "b"
o3.Type = model.CHANNEL_OPEN
- Must(store.Channel().Save(&o3))
+ Must(store.Channel().Save(utils.T, &o3))
o4 := model.Channel{}
o4.TeamId = o1.TeamId
o4.DisplayName = "ChannelB"
o4.Name = "a" + model.NewId() + "b"
o4.Type = model.CHANNEL_PRIVATE
- Must(store.Channel().Save(&o4))
+ Must(store.Channel().Save(utils.T, &o4))
o5 := model.Channel{}
o5.TeamId = o1.TeamId
o5.DisplayName = "ChannelC"
o5.Name = "a" + model.NewId() + "b"
o5.Type = model.CHANNEL_PRIVATE
- Must(store.Channel().Save(&o5))
+ Must(store.Channel().Save(utils.T, &o5))
- cresult := <-store.Channel().GetMoreChannels(o1.TeamId, m1.UserId)
+ cresult := <-store.Channel().GetMoreChannels(utils.T, o1.TeamId, m1.UserId)
list := cresult.Data.(*model.ChannelList)
if len(list.Channels) != 1 {
@@ -619,7 +620,7 @@ func TestChannelStoreGetMoreChannels(t *testing.T) {
t.Fatal("missing channel")
}
- if r1 := <-store.Channel().AnalyticsTypeCount(o1.TeamId, model.CHANNEL_OPEN); r1.Err != nil {
+ if r1 := <-store.Channel().AnalyticsTypeCount(utils.T, o1.TeamId, model.CHANNEL_OPEN); r1.Err != nil {
t.Fatal(r1.Err)
} else {
if r1.Data.(int64) != 2 {
@@ -628,7 +629,7 @@ func TestChannelStoreGetMoreChannels(t *testing.T) {
}
}
- if r1 := <-store.Channel().AnalyticsTypeCount(o1.TeamId, model.CHANNEL_PRIVATE); r1.Err != nil {
+ if r1 := <-store.Channel().AnalyticsTypeCount(utils.T, o1.TeamId, model.CHANNEL_PRIVATE); r1.Err != nil {
t.Fatal(r1.Err)
} else {
if r1.Data.(int64) != 2 {
@@ -646,34 +647,34 @@ func TestChannelStoreGetChannelCounts(t *testing.T) {
o2.DisplayName = "Channel2"
o2.Name = "a" + model.NewId() + "b"
o2.Type = model.CHANNEL_OPEN
- Must(store.Channel().Save(&o2))
+ Must(store.Channel().Save(utils.T, &o2))
o1 := model.Channel{}
o1.TeamId = model.NewId()
o1.DisplayName = "Channel1"
o1.Name = "a" + model.NewId() + "b"
o1.Type = model.CHANNEL_OPEN
- Must(store.Channel().Save(&o1))
+ Must(store.Channel().Save(utils.T, &o1))
m1 := model.ChannelMember{}
m1.ChannelId = o1.Id
m1.UserId = model.NewId()
m1.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(&m1))
+ Must(store.Channel().SaveMember(utils.T, &m1))
m2 := model.ChannelMember{}
m2.ChannelId = o1.Id
m2.UserId = model.NewId()
m2.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(&m2))
+ Must(store.Channel().SaveMember(utils.T, &m2))
m3 := model.ChannelMember{}
m3.ChannelId = o2.Id
m3.UserId = model.NewId()
m3.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(&m3))
+ Must(store.Channel().SaveMember(utils.T, &m3))
- cresult := <-store.Channel().GetChannelCounts(o1.TeamId, m1.UserId)
+ cresult := <-store.Channel().GetChannelCounts(utils.T, o1.TeamId, m1.UserId)
counts := cresult.Data.(*model.ChannelCounts)
if len(counts.Counts) != 1 {
@@ -694,20 +695,20 @@ func TestChannelStoreUpdateLastViewedAt(t *testing.T) {
o1.Name = "a" + model.NewId() + "b"
o1.Type = model.CHANNEL_OPEN
o1.TotalMsgCount = 25
- Must(store.Channel().Save(&o1))
+ Must(store.Channel().Save(utils.T, &o1))
m1 := model.ChannelMember{}
m1.ChannelId = o1.Id
m1.UserId = model.NewId()
m1.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(&m1))
+ Must(store.Channel().SaveMember(utils.T, &m1))
- err := (<-store.Channel().UpdateLastViewedAt(m1.ChannelId, m1.UserId)).Err
+ err := (<-store.Channel().UpdateLastViewedAt(utils.T, m1.ChannelId, m1.UserId)).Err
if err != nil {
t.Fatal("failed to update", err)
}
- err = (<-store.Channel().UpdateLastViewedAt(m1.ChannelId, "missing id")).Err
+ err = (<-store.Channel().UpdateLastViewedAt(utils.T, m1.ChannelId, "missing id")).Err
if err != nil {
t.Fatal("failed to update")
}
@@ -722,30 +723,30 @@ func TestChannelStoreIncrementMentionCount(t *testing.T) {
o1.Name = "a" + model.NewId() + "b"
o1.Type = model.CHANNEL_OPEN
o1.TotalMsgCount = 25
- Must(store.Channel().Save(&o1))
+ Must(store.Channel().Save(utils.T, &o1))
m1 := model.ChannelMember{}
m1.ChannelId = o1.Id
m1.UserId = model.NewId()
m1.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(&m1))
+ Must(store.Channel().SaveMember(utils.T, &m1))
- err := (<-store.Channel().IncrementMentionCount(m1.ChannelId, m1.UserId)).Err
+ err := (<-store.Channel().IncrementMentionCount(utils.T, m1.ChannelId, m1.UserId)).Err
if err != nil {
t.Fatal("failed to update")
}
- err = (<-store.Channel().IncrementMentionCount(m1.ChannelId, "missing id")).Err
+ err = (<-store.Channel().IncrementMentionCount(utils.T, m1.ChannelId, "missing id")).Err
if err != nil {
t.Fatal("failed to update")
}
- err = (<-store.Channel().IncrementMentionCount("missing id", m1.UserId)).Err
+ err = (<-store.Channel().IncrementMentionCount(utils.T, "missing id", m1.UserId)).Err
if err != nil {
t.Fatal("failed to update")
}
- err = (<-store.Channel().IncrementMentionCount("missing id", "missing id")).Err
+ err = (<-store.Channel().IncrementMentionCount(utils.T, "missing id", "missing id")).Err
if err != nil {
t.Fatal("failed to update")
}
diff --git a/store/sql_post_store_test.go b/store/sql_post_store_test.go
index 07f152dc4..5f022becf 100644
--- a/store/sql_post_store_test.go
+++ b/store/sql_post_store_test.go
@@ -655,20 +655,20 @@ func TestPostStoreSearch(t *testing.T) {
c1.DisplayName = "Channel1"
c1.Name = "a" + model.NewId() + "b"
c1.Type = model.CHANNEL_OPEN
- c1 = (<-store.Channel().Save(c1)).Data.(*model.Channel)
+ c1 = (<-store.Channel().Save(utils.T, c1)).Data.(*model.Channel)
m1 := model.ChannelMember{}
m1.ChannelId = c1.Id
m1.UserId = userId
m1.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(&m1))
+ Must(store.Channel().SaveMember(utils.T, &m1))
c2 := &model.Channel{}
c2.TeamId = teamId
c2.DisplayName = "Channel1"
c2.Name = "a" + model.NewId() + "b"
c2.Type = model.CHANNEL_OPEN
- c2 = (<-store.Channel().Save(c2)).Data.(*model.Channel)
+ c2 = (<-store.Channel().Save(utils.T, c2)).Data.(*model.Channel)
o1 := &model.Post{}
o1.ChannelId = c1.Id
@@ -772,7 +772,7 @@ func TestUserCountsWithPostsByDay(t *testing.T) {
c1.DisplayName = "Channel2"
c1.Name = "a" + model.NewId() + "b"
c1.Type = model.CHANNEL_OPEN
- c1 = Must(store.Channel().Save(c1)).(*model.Channel)
+ c1 = Must(store.Channel().Save(utils.T, c1)).(*model.Channel)
o1 := &model.Post{}
o1.ChannelId = c1.Id
@@ -832,7 +832,7 @@ func TestPostCountsByDay(t *testing.T) {
c1.DisplayName = "Channel2"
c1.Name = "a" + model.NewId() + "b"
c1.Type = model.CHANNEL_OPEN
- c1 = Must(store.Channel().Save(c1)).(*model.Channel)
+ c1 = Must(store.Channel().Save(utils.T, c1)).(*model.Channel)
o1 := &model.Post{}
o1.ChannelId = c1.Id
diff --git a/store/store.go b/store/store.go
index fe103032e..a6162fb07 100644
--- a/store/store.go
+++ b/store/store.go
@@ -58,33 +58,33 @@ type TeamStore interface {
}
type ChannelStore interface {
- Save(channel *model.Channel) StoreChannel
- SaveDirectChannel(channel *model.Channel, member1 *model.ChannelMember, member2 *model.ChannelMember) StoreChannel
- Update(channel *model.Channel) StoreChannel
- Get(id string) StoreChannel
- GetFromMaster(id string) StoreChannel
- Delete(channelId string, time int64) StoreChannel
- PermanentDeleteByTeam(teamId string) StoreChannel
- GetByName(team_id string, domain string) StoreChannel
- GetChannels(teamId string, userId string) StoreChannel
- GetMoreChannels(teamId string, userId string) StoreChannel
- GetChannelCounts(teamId string, userId string) StoreChannel
- GetForExport(teamId string) StoreChannel
-
- SaveMember(member *model.ChannelMember) StoreChannel
- UpdateMember(member *model.ChannelMember) StoreChannel
- GetMembers(channelId string) StoreChannel
- GetMember(channelId string, userId string) StoreChannel
- GetMemberCount(channelId string) StoreChannel
- RemoveMember(channelId string, userId string) StoreChannel
- PermanentDeleteMembersByUser(userId string) StoreChannel
- GetExtraMembers(channelId string, limit int) StoreChannel
- CheckPermissionsTo(teamId string, channelId string, userId string) StoreChannel
- CheckOpenChannelPermissions(teamId string, channelId string) StoreChannel
- CheckPermissionsToByName(teamId string, channelName string, userId string) StoreChannel
- UpdateLastViewedAt(channelId string, userId string) StoreChannel
- IncrementMentionCount(channelId string, userId string) StoreChannel
- AnalyticsTypeCount(teamId string, channelType string) StoreChannel
+ Save(T goi18n.TranslateFunc, channel *model.Channel) StoreChannel
+ SaveDirectChannel(T goi18n.TranslateFunc, channel *model.Channel, member1 *model.ChannelMember, member2 *model.ChannelMember) StoreChannel
+ Update(T goi18n.TranslateFunc, channel *model.Channel) StoreChannel
+ Get(T goi18n.TranslateFunc, id string) StoreChannel
+ GetFromMaster(T goi18n.TranslateFunc, id string) StoreChannel
+ Delete(T goi18n.TranslateFunc, channelId string, time int64) StoreChannel
+ PermanentDeleteByTeam(T goi18n.TranslateFunc, teamId string) StoreChannel
+ GetByName(T goi18n.TranslateFunc, team_id string, domain string) StoreChannel
+ GetChannels(T goi18n.TranslateFunc, teamId string, userId string) StoreChannel
+ GetMoreChannels(T goi18n.TranslateFunc, teamId string, userId string) StoreChannel
+ GetChannelCounts(T goi18n.TranslateFunc, teamId string, userId string) StoreChannel
+ GetForExport(T goi18n.TranslateFunc, teamId string) StoreChannel
+
+ SaveMember(T goi18n.TranslateFunc, member *model.ChannelMember) StoreChannel
+ UpdateMember(T goi18n.TranslateFunc, member *model.ChannelMember) StoreChannel
+ GetMembers(T goi18n.TranslateFunc, channelId string) StoreChannel
+ GetMember(T goi18n.TranslateFunc, channelId string, userId string) StoreChannel
+ GetMemberCount(T goi18n.TranslateFunc, channelId string) StoreChannel
+ RemoveMember(T goi18n.TranslateFunc, channelId string, userId string) StoreChannel
+ PermanentDeleteMembersByUser(T goi18n.TranslateFunc, userId string) StoreChannel
+ GetExtraMembers(T goi18n.TranslateFunc, channelId string, limit int) StoreChannel
+ CheckPermissionsTo(T goi18n.TranslateFunc, teamId string, channelId string, userId string) StoreChannel
+ CheckOpenChannelPermissions(T goi18n.TranslateFunc, teamId string, channelId string) StoreChannel
+ CheckPermissionsToByName(T goi18n.TranslateFunc, teamId string, channelName string, userId string) StoreChannel
+ UpdateLastViewedAt(T goi18n.TranslateFunc, channelId string, userId string) StoreChannel
+ IncrementMentionCount(T goi18n.TranslateFunc, channelId string, userId string) StoreChannel
+ AnalyticsTypeCount(T goi18n.TranslateFunc, teamId string, channelType string) StoreChannel
}
type PostStore interface {