summaryrefslogtreecommitdiffstats
path: root/store
diff options
context:
space:
mode:
authorCorey Hulen <corey@hulen.com>2016-01-20 13:36:16 -0600
committerCorey Hulen <corey@hulen.com>2016-01-20 13:36:16 -0600
commitaefbb541d0d5bdd9919fef44fbf1a1fbfeaeb58b (patch)
treed87809ff2a306e5428b0ab6973d05509baa21abd /store
parent0b1aff3b24b4ac2df8e963c83d6e52b127c603f9 (diff)
downloadchat-aefbb541d0d5bdd9919fef44fbf1a1fbfeaeb58b.tar.gz
chat-aefbb541d0d5bdd9919fef44fbf1a1fbfeaeb58b.tar.bz2
chat-aefbb541d0d5bdd9919fef44fbf1a1fbfeaeb58b.zip
Revert " PLT-7 adding loc for db calls"
Diffstat (limited to 'store')
-rw-r--r--store/sql_audit_store.go7
-rw-r--r--store/sql_audit_store_test.go15
-rw-r--r--store/sql_channel_store.go83
-rw-r--r--store/sql_channel_store_test.go215
-rw-r--r--store/sql_oauth_store.go25
-rw-r--r--store/sql_oauth_store_test.go45
-rw-r--r--store/sql_post_store.go53
-rw-r--r--store/sql_post_store_test.go236
-rw-r--r--store/sql_preference_store.go27
-rw-r--r--store/sql_preference_store_test.go43
-rw-r--r--store/sql_session_store.go23
-rw-r--r--store/sql_session_store_test.go53
-rw-r--r--store/sql_store.go12
-rw-r--r--store/sql_system_store.go7
-rw-r--r--store/sql_system_store_test.go9
-rw-r--r--store/sql_team_store.go21
-rw-r--r--store/sql_team_store_test.go65
-rw-r--r--store/sql_user_store.go46
-rw-r--r--store/sql_user_store_test.go113
-rw-r--r--store/sql_webhook_store.go29
-rw-r--r--store/sql_webhook_store_test.go81
-rw-r--r--store/store.go242
22 files changed, 714 insertions, 736 deletions
diff --git a/store/sql_audit_store.go b/store/sql_audit_store.go
index 720e4f483..f4fd29aab 100644
--- a/store/sql_audit_store.go
+++ b/store/sql_audit_store.go
@@ -5,7 +5,6 @@ package store
import (
"github.com/mattermost/platform/model"
- goi18n "github.com/nicksnyder/go-i18n/i18n"
)
type SqlAuditStore struct {
@@ -35,7 +34,7 @@ func (s SqlAuditStore) CreateIndexesIfNotExists() {
s.CreateIndexIfNotExists("idx_audits_user_id", "Audits", "UserId")
}
-func (s SqlAuditStore) Save(T goi18n.TranslateFunc, audit *model.Audit) StoreChannel {
+func (s SqlAuditStore) Save(audit *model.Audit) StoreChannel {
storeChannel := make(StoreChannel)
@@ -58,7 +57,7 @@ func (s SqlAuditStore) Save(T goi18n.TranslateFunc, audit *model.Audit) StoreCha
return storeChannel
}
-func (s SqlAuditStore) Get(T goi18n.TranslateFunc, user_id string, limit int) StoreChannel {
+func (s SqlAuditStore) Get(user_id string, limit int) StoreChannel {
storeChannel := make(StoreChannel)
@@ -88,7 +87,7 @@ func (s SqlAuditStore) Get(T goi18n.TranslateFunc, user_id string, limit int) St
return storeChannel
}
-func (s SqlAuditStore) PermanentDeleteByUser(T goi18n.TranslateFunc, userId string) StoreChannel {
+func (s SqlAuditStore) PermanentDeleteByUser(userId string) StoreChannel {
storeChannel := make(StoreChannel)
diff --git a/store/sql_audit_store_test.go b/store/sql_audit_store_test.go
index 55147ad6f..b395631f1 100644
--- a/store/sql_audit_store_test.go
+++ b/store/sql_audit_store_test.go
@@ -5,7 +5,6 @@ package store
import (
"github.com/mattermost/platform/model"
- "github.com/mattermost/platform/utils"
"testing"
"time"
)
@@ -14,19 +13,19 @@ func TestSqlAuditStore(t *testing.T) {
Setup()
audit := &model.Audit{UserId: model.NewId(), IpAddress: "ipaddress", Action: "Action"}
- Must(store.Audit().Save(utils.T, audit))
+ Must(store.Audit().Save(audit))
time.Sleep(100 * time.Millisecond)
- Must(store.Audit().Save(utils.T, audit))
+ Must(store.Audit().Save(audit))
time.Sleep(100 * time.Millisecond)
- Must(store.Audit().Save(utils.T, audit))
+ Must(store.Audit().Save(audit))
time.Sleep(100 * time.Millisecond)
audit.ExtraInfo = "extra"
time.Sleep(100 * time.Millisecond)
- Must(store.Audit().Save(utils.T, audit))
+ Must(store.Audit().Save(audit))
time.Sleep(100 * time.Millisecond)
- c := store.Audit().Get(utils.T, audit.UserId, 100)
+ c := store.Audit().Get(audit.UserId, 100)
result := <-c
audits := result.Data.(model.Audits)
@@ -38,7 +37,7 @@ func TestSqlAuditStore(t *testing.T) {
t.Fatal("Failed to save property for extra info")
}
- c = store.Audit().Get(utils.T, "missing", 100)
+ c = store.Audit().Get("missing", 100)
result = <-c
audits = result.Data.(model.Audits)
@@ -46,7 +45,7 @@ func TestSqlAuditStore(t *testing.T) {
t.Fatal("Should have returned empty because user_id is missing")
}
- if r2 := <-store.Audit().PermanentDeleteByUser(utils.T, audit.UserId); r2.Err != nil {
+ if r2 := <-store.Audit().PermanentDeleteByUser(audit.UserId); r2.Err != nil {
t.Fatal(r2.Err)
}
}
diff --git a/store/sql_channel_store.go b/store/sql_channel_store.go
index d85969b21..4585647de 100644
--- a/store/sql_channel_store.go
+++ b/store/sql_channel_store.go
@@ -7,7 +7,6 @@ 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 {
@@ -50,7 +49,7 @@ func (s SqlChannelStore) CreateIndexesIfNotExists() {
s.CreateIndexIfNotExists("idx_channelmembers_user_id", "ChannelMembers", "UserId")
}
-func (s SqlChannelStore) Save(T goi18n.TranslateFunc, channel *model.Channel) StoreChannel {
+func (s SqlChannelStore) Save(channel *model.Channel) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -61,7 +60,7 @@ func (s SqlChannelStore) Save(T goi18n.TranslateFunc, channel *model.Channel) St
if transaction, err := s.GetMaster().Begin(); err != nil {
result.Err = model.NewAppError("SqlChannelStore.Save", "Unable to open transaction", err.Error())
} else {
- result = s.saveChannelT(T, transaction, channel)
+ result = s.saveChannelT(transaction, channel)
if result.Err != nil {
transaction.Rollback()
} else {
@@ -79,7 +78,7 @@ func (s SqlChannelStore) Save(T goi18n.TranslateFunc, channel *model.Channel) St
return storeChannel
}
-func (s SqlChannelStore) SaveDirectChannel(T goi18n.TranslateFunc, directchannel *model.Channel, member1 *model.ChannelMember, member2 *model.ChannelMember) StoreChannel {
+func (s SqlChannelStore) SaveDirectChannel(directchannel *model.Channel, member1 *model.ChannelMember, member2 *model.ChannelMember) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -91,7 +90,7 @@ func (s SqlChannelStore) SaveDirectChannel(T goi18n.TranslateFunc, directchannel
if transaction, err := s.GetMaster().Begin(); err != nil {
result.Err = model.NewAppError("SqlChannelStore.SaveDirectChannel", "Unable to open transaction", err.Error())
} else {
- channelResult := s.saveChannelT(T, transaction, directchannel)
+ channelResult := s.saveChannelT(transaction, directchannel)
if channelResult.Err != nil {
transaction.Rollback()
@@ -102,8 +101,8 @@ func (s SqlChannelStore) SaveDirectChannel(T goi18n.TranslateFunc, directchannel
member1.ChannelId = newChannel.Id
member2.ChannelId = newChannel.Id
- member1Result := s.saveMemberT(T, transaction, member1, newChannel)
- member2Result := s.saveMemberT(T, transaction, member2, newChannel)
+ member1Result := s.saveMemberT(transaction, member1, newChannel)
+ member2Result := s.saveMemberT(transaction, member2, newChannel)
if member1Result.Err != nil || member2Result.Err != nil {
transaction.Rollback()
@@ -133,7 +132,7 @@ func (s SqlChannelStore) SaveDirectChannel(T goi18n.TranslateFunc, directchannel
return storeChannel
}
-func (s SqlChannelStore) saveChannelT(T goi18n.TranslateFunc, transaction *gorp.Transaction, channel *model.Channel) StoreResult {
+func (s SqlChannelStore) saveChannelT(transaction *gorp.Transaction, channel *model.Channel) StoreResult {
result := StoreResult{}
if len(channel.Id) > 0 {
@@ -175,7 +174,7 @@ func (s SqlChannelStore) saveChannelT(T goi18n.TranslateFunc, transaction *gorp.
return result
}
-func (s SqlChannelStore) Update(T goi18n.TranslateFunc, channel *model.Channel) StoreChannel {
+func (s SqlChannelStore) Update(channel *model.Channel) StoreChannel {
storeChannel := make(StoreChannel)
@@ -215,7 +214,7 @@ func (s SqlChannelStore) Update(T goi18n.TranslateFunc, channel *model.Channel)
return storeChannel
}
-func (s SqlChannelStore) extraUpdated(T goi18n.TranslateFunc, channel *model.Channel) StoreChannel {
+func (s SqlChannelStore) extraUpdated(channel *model.Channel) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -243,15 +242,15 @@ func (s SqlChannelStore) extraUpdated(T goi18n.TranslateFunc, channel *model.Cha
return storeChannel
}
-func (s SqlChannelStore) Get(T goi18n.TranslateFunc, id string) StoreChannel {
- return s.get(T, id, false)
+func (s SqlChannelStore) Get(id string) StoreChannel {
+ return s.get(id, false)
}
-func (s SqlChannelStore) GetFromMaster(T goi18n.TranslateFunc, id string) StoreChannel {
- return s.get(T, id, true)
+func (s SqlChannelStore) GetFromMaster(id string) StoreChannel {
+ return s.get(id, true)
}
-func (s SqlChannelStore) get(T goi18n.TranslateFunc, id string, master bool) StoreChannel {
+func (s SqlChannelStore) get(id string, master bool) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -279,7 +278,7 @@ func (s SqlChannelStore) get(T goi18n.TranslateFunc, id string, master bool) Sto
return storeChannel
}
-func (s SqlChannelStore) Delete(T goi18n.TranslateFunc, channelId string, time int64) StoreChannel {
+func (s SqlChannelStore) Delete(channelId string, time int64) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -297,7 +296,7 @@ func (s SqlChannelStore) Delete(T goi18n.TranslateFunc, channelId string, time i
return storeChannel
}
-func (s SqlChannelStore) PermanentDeleteByTeam(T goi18n.TranslateFunc, teamId string) StoreChannel {
+func (s SqlChannelStore) PermanentDeleteByTeam(teamId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -319,7 +318,7 @@ type channelWithMember struct {
model.ChannelMember
}
-func (s SqlChannelStore) GetChannels(T goi18n.TranslateFunc, teamId string, userId string) StoreChannel {
+func (s SqlChannelStore) GetChannels(teamId string, userId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -352,7 +351,7 @@ func (s SqlChannelStore) GetChannels(T goi18n.TranslateFunc, teamId string, user
return storeChannel
}
-func (s SqlChannelStore) GetMoreChannels(T goi18n.TranslateFunc, teamId string, userId string) StoreChannel {
+func (s SqlChannelStore) GetMoreChannels(teamId string, userId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -400,7 +399,7 @@ type channelIdWithCountAndUpdateAt struct {
UpdateAt int64
}
-func (s SqlChannelStore) GetChannelCounts(T goi18n.TranslateFunc, teamId string, userId string) StoreChannel {
+func (s SqlChannelStore) GetChannelCounts(teamId string, userId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -429,7 +428,7 @@ func (s SqlChannelStore) GetChannelCounts(T goi18n.TranslateFunc, teamId string,
return storeChannel
}
-func (s SqlChannelStore) GetByName(T goi18n.TranslateFunc, teamId string, name string) StoreChannel {
+func (s SqlChannelStore) GetByName(teamId string, name string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -450,13 +449,13 @@ func (s SqlChannelStore) GetByName(T goi18n.TranslateFunc, teamId string, name s
return storeChannel
}
-func (s SqlChannelStore) SaveMember(T goi18n.TranslateFunc, member *model.ChannelMember) StoreChannel {
+func (s SqlChannelStore) SaveMember(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(T, member.ChannelId); cr.Err != nil {
+ if cr := <-s.GetFromMaster(member.ChannelId); cr.Err != nil {
result.Err = cr.Err
} else {
channel := cr.Data.(*model.Channel)
@@ -464,7 +463,7 @@ func (s SqlChannelStore) SaveMember(T goi18n.TranslateFunc, member *model.Channe
if transaction, err := s.GetMaster().Begin(); err != nil {
result.Err = model.NewAppError("SqlChannelStore.SaveMember", "Unable to open transaction", err.Error())
} else {
- result = s.saveMemberT(T, transaction, member, channel)
+ result = s.saveMemberT(transaction, member, channel)
if result.Err != nil {
transaction.Rollback()
} else {
@@ -472,7 +471,7 @@ func (s SqlChannelStore) SaveMember(T goi18n.TranslateFunc, member *model.Channe
result.Err = model.NewAppError("SqlChannelStore.SaveMember", "Unable to commit transaction", err.Error())
}
// If sucessfull record members have changed in channel
- if mu := <-s.extraUpdated(T, channel); mu.Err != nil {
+ if mu := <-s.extraUpdated(channel); mu.Err != nil {
result.Err = mu.Err
}
}
@@ -486,7 +485,7 @@ func (s SqlChannelStore) SaveMember(T goi18n.TranslateFunc, member *model.Channe
return storeChannel
}
-func (s SqlChannelStore) saveMemberT(T goi18n.TranslateFunc, transaction *gorp.Transaction, member *model.ChannelMember, channel *model.Channel) StoreResult {
+func (s SqlChannelStore) saveMemberT(transaction *gorp.Transaction, member *model.ChannelMember, channel *model.Channel) StoreResult {
result := StoreResult{}
member.PreSave()
@@ -507,7 +506,7 @@ func (s SqlChannelStore) saveMemberT(T goi18n.TranslateFunc, transaction *gorp.T
return result
}
-func (s SqlChannelStore) UpdateMember(T goi18n.TranslateFunc, member *model.ChannelMember) StoreChannel {
+func (s SqlChannelStore) UpdateMember(member *model.ChannelMember) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -535,7 +534,7 @@ func (s SqlChannelStore) UpdateMember(T goi18n.TranslateFunc, member *model.Chan
return storeChannel
}
-func (s SqlChannelStore) GetMembers(T goi18n.TranslateFunc, channelId string) StoreChannel {
+func (s SqlChannelStore) GetMembers(channelId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -556,7 +555,7 @@ func (s SqlChannelStore) GetMembers(T goi18n.TranslateFunc, channelId string) St
return storeChannel
}
-func (s SqlChannelStore) GetMember(T goi18n.TranslateFunc, channelId string, userId string) StoreChannel {
+func (s SqlChannelStore) GetMember(channelId string, userId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -577,7 +576,7 @@ func (s SqlChannelStore) GetMember(T goi18n.TranslateFunc, channelId string, use
return storeChannel
}
-func (s SqlChannelStore) GetMemberCount(T goi18n.TranslateFunc, channelId string) StoreChannel {
+func (s SqlChannelStore) GetMemberCount(channelId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -597,7 +596,7 @@ func (s SqlChannelStore) GetMemberCount(T goi18n.TranslateFunc, channelId string
return storeChannel
}
-func (s SqlChannelStore) GetExtraMembers(T goi18n.TranslateFunc, channelId string, limit int) StoreChannel {
+func (s SqlChannelStore) GetExtraMembers(channelId string, limit int) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -628,14 +627,14 @@ func (s SqlChannelStore) GetExtraMembers(T goi18n.TranslateFunc, channelId strin
return storeChannel
}
-func (s SqlChannelStore) RemoveMember(T goi18n.TranslateFunc, channelId string, userId string) StoreChannel {
+func (s SqlChannelStore) RemoveMember(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(T, channelId); cr.Err != nil {
+ if cr := <-s.Get(channelId); cr.Err != nil {
result.Err = cr.Err
} else {
channel := cr.Data.(*model.Channel)
@@ -645,7 +644,7 @@ func (s SqlChannelStore) RemoveMember(T goi18n.TranslateFunc, channelId string,
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(T, channel); mu.Err != nil {
+ if mu := <-s.extraUpdated(channel); mu.Err != nil {
result.Err = mu.Err
}
}
@@ -658,7 +657,7 @@ func (s SqlChannelStore) RemoveMember(T goi18n.TranslateFunc, channelId string,
return storeChannel
}
-func (s SqlChannelStore) PermanentDeleteMembersByUser(T goi18n.TranslateFunc, userId string) StoreChannel {
+func (s SqlChannelStore) PermanentDeleteMembersByUser(userId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -675,7 +674,7 @@ func (s SqlChannelStore) PermanentDeleteMembersByUser(T goi18n.TranslateFunc, us
return storeChannel
}
-func (s SqlChannelStore) CheckPermissionsTo(T goi18n.TranslateFunc, teamId string, channelId string, userId string) StoreChannel {
+func (s SqlChannelStore) CheckPermissionsTo(teamId string, channelId string, userId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -707,7 +706,7 @@ func (s SqlChannelStore) CheckPermissionsTo(T goi18n.TranslateFunc, teamId strin
return storeChannel
}
-func (s SqlChannelStore) CheckPermissionsToByName(T goi18n.TranslateFunc, teamId string, channelName string, userId string) StoreChannel {
+func (s SqlChannelStore) CheckPermissionsToByName(teamId string, channelName string, userId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -739,7 +738,7 @@ func (s SqlChannelStore) CheckPermissionsToByName(T goi18n.TranslateFunc, teamId
return storeChannel
}
-func (s SqlChannelStore) CheckOpenChannelPermissions(T goi18n.TranslateFunc, teamId string, channelId string) StoreChannel {
+func (s SqlChannelStore) CheckOpenChannelPermissions(teamId string, channelId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -768,7 +767,7 @@ func (s SqlChannelStore) CheckOpenChannelPermissions(T goi18n.TranslateFunc, tea
return storeChannel
}
-func (s SqlChannelStore) UpdateLastViewedAt(T goi18n.TranslateFunc, channelId string, userId string) StoreChannel {
+func (s SqlChannelStore) UpdateLastViewedAt(channelId string, userId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -816,7 +815,7 @@ func (s SqlChannelStore) UpdateLastViewedAt(T goi18n.TranslateFunc, channelId st
return storeChannel
}
-func (s SqlChannelStore) IncrementMentionCount(T goi18n.TranslateFunc, channelId string, userId string) StoreChannel {
+func (s SqlChannelStore) IncrementMentionCount(channelId string, userId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -842,7 +841,7 @@ func (s SqlChannelStore) IncrementMentionCount(T goi18n.TranslateFunc, channelId
return storeChannel
}
-func (s SqlChannelStore) GetForExport(T goi18n.TranslateFunc, teamId string) StoreChannel {
+func (s SqlChannelStore) GetForExport(teamId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -864,7 +863,7 @@ func (s SqlChannelStore) GetForExport(T goi18n.TranslateFunc, teamId string) Sto
return storeChannel
}
-func (s SqlChannelStore) AnalyticsTypeCount(T goi18n.TranslateFunc, teamId string, channelType string) StoreChannel {
+func (s SqlChannelStore) AnalyticsTypeCount(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 079fab92b..8b22fbb7a 100644
--- a/store/sql_channel_store_test.go
+++ b/store/sql_channel_store_test.go
@@ -5,7 +5,6 @@ package store
import (
"github.com/mattermost/platform/model"
- "github.com/mattermost/platform/utils"
"testing"
"time"
)
@@ -21,23 +20,23 @@ func TestChannelStoreSave(t *testing.T) {
o1.Name = "a" + model.NewId() + "b"
o1.Type = model.CHANNEL_OPEN
- if err := (<-store.Channel().Save(utils.T, &o1)).Err; err != nil {
+ if err := (<-store.Channel().Save(&o1)).Err; err != nil {
t.Fatal("couldn't save item", err)
}
- if err := (<-store.Channel().Save(utils.T, &o1)).Err; err == nil {
+ if err := (<-store.Channel().Save(&o1)).Err; err == nil {
t.Fatal("shouldn't be able to update from save")
}
o1.Id = ""
- if err := (<-store.Channel().Save(utils.T, &o1)).Err; err == nil {
+ if err := (<-store.Channel().Save(&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(utils.T, &o1)).Err; err == nil {
+ if err := (<-store.Channel().Save(&o1)).Err; err == nil {
t.Fatal("Should not be able to save direct channel")
}
@@ -45,14 +44,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(utils.T, &o1)).Err; err != nil {
+ if err := (<-store.Channel().Save(&o1)).Err; err != nil {
t.Fatal("couldn't save item", err)
}
}
o1.Id = ""
o1.Name = "a" + model.NewId() + "b"
- if err := (<-store.Channel().Save(utils.T, &o1)).Err; err == nil {
+ if err := (<-store.Channel().Save(&o1)).Err; err == nil {
t.Fatal("should be the limit")
}
}
@@ -72,13 +71,13 @@ func TestChannelStoreSaveDirectChannel(t *testing.T) {
u1.TeamId = model.NewId()
u1.Email = model.NewId()
u1.Nickname = model.NewId()
- Must(store.User().Save(utils.T, &u1))
+ Must(store.User().Save(&u1))
u2 := model.User{}
u2.TeamId = model.NewId()
u2.Email = model.NewId()
u2.Nickname = model.NewId()
- Must(store.User().Save(utils.T, &u2))
+ Must(store.User().Save(&u2))
m1 := model.ChannelMember{}
m1.ChannelId = o1.Id
@@ -90,23 +89,23 @@ func TestChannelStoreSaveDirectChannel(t *testing.T) {
m2.UserId = u2.Id
m2.NotifyProps = model.GetDefaultChannelNotifyProps()
- if err := (<-store.Channel().SaveDirectChannel(utils.T, &o1, &m1, &m2)).Err; err != nil {
+ if err := (<-store.Channel().SaveDirectChannel(&o1, &m1, &m2)).Err; err != nil {
t.Fatal("couldn't save direct channel", err)
}
- members := (<-store.Channel().GetMembers(utils.T, o1.Id)).Data.([]model.ChannelMember)
+ members := (<-store.Channel().GetMembers(o1.Id)).Data.([]model.ChannelMember)
if len(members) != 2 {
t.Fatal("should have saved 2 members")
}
- if err := (<-store.Channel().SaveDirectChannel(utils.T, &o1, &m1, &m2)).Err; err == nil {
+ if err := (<-store.Channel().SaveDirectChannel(&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(utils.T, &o1, &m1, &m2)).Err; err == nil {
+ if err := (<-store.Channel().SaveDirectChannel(&o1, &m1, &m2)).Err; err == nil {
t.Fatal("Should not be able to save non-direct channel")
}
@@ -121,23 +120,23 @@ func TestChannelStoreUpdate(t *testing.T) {
o1.Name = "a" + model.NewId() + "b"
o1.Type = model.CHANNEL_OPEN
- if err := (<-store.Channel().Save(utils.T, &o1)).Err; err != nil {
+ if err := (<-store.Channel().Save(&o1)).Err; err != nil {
t.Fatal(err)
}
time.Sleep(100 * time.Millisecond)
- if err := (<-store.Channel().Update(utils.T, &o1)).Err; err != nil {
+ if err := (<-store.Channel().Update(&o1)).Err; err != nil {
t.Fatal(err)
}
o1.Id = "missing"
- if err := (<-store.Channel().Update(utils.T, &o1)).Err; err == nil {
+ if err := (<-store.Channel().Update(&o1)).Err; err == nil {
t.Fatal("Update should have failed because of missing key")
}
o1.Id = model.NewId()
- if err := (<-store.Channel().Update(utils.T, &o1)).Err; err == nil {
+ if err := (<-store.Channel().Update(&o1)).Err; err == nil {
t.Fatal("Update should have faile because id change")
}
}
@@ -150,9 +149,9 @@ func TestChannelStoreGet(t *testing.T) {
o1.DisplayName = "Name"
o1.Name = "a" + model.NewId() + "b"
o1.Type = model.CHANNEL_OPEN
- Must(store.Channel().Save(utils.T, &o1))
+ Must(store.Channel().Save(&o1))
- if r1 := <-store.Channel().Get(utils.T, o1.Id); r1.Err != nil {
+ if r1 := <-store.Channel().Get(o1.Id); r1.Err != nil {
t.Fatal(r1.Err)
} else {
if r1.Data.(*model.Channel).ToJson() != o1.ToJson() {
@@ -160,7 +159,7 @@ func TestChannelStoreGet(t *testing.T) {
}
}
- if err := (<-store.Channel().Get(utils.T, "")).Err; err == nil {
+ if err := (<-store.Channel().Get("")).Err; err == nil {
t.Fatal("Missing id should have failed")
}
@@ -168,13 +167,13 @@ func TestChannelStoreGet(t *testing.T) {
u1.TeamId = model.NewId()
u1.Email = model.NewId()
u1.Nickname = model.NewId()
- Must(store.User().Save(utils.T, &u1))
+ Must(store.User().Save(&u1))
u2 := model.User{}
u2.TeamId = model.NewId()
u2.Email = model.NewId()
u2.Nickname = model.NewId()
- Must(store.User().Save(utils.T, &u2))
+ Must(store.User().Save(&u2))
o2 := model.Channel{}
o2.TeamId = model.NewId()
@@ -192,9 +191,9 @@ func TestChannelStoreGet(t *testing.T) {
m2.UserId = u2.Id
m2.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveDirectChannel(utils.T, &o2, &m1, &m2))
+ Must(store.Channel().SaveDirectChannel(&o2, &m1, &m2))
- if r2 := <-store.Channel().Get(utils.T, o2.Id); r2.Err != nil {
+ if r2 := <-store.Channel().Get(o2.Id); r2.Err != nil {
t.Fatal(r2.Err)
} else {
if r2.Data.(*model.Channel).ToJson() != o2.ToJson() {
@@ -211,61 +210,61 @@ func TestChannelStoreDelete(t *testing.T) {
o1.DisplayName = "Channel1"
o1.Name = "a" + model.NewId() + "b"
o1.Type = model.CHANNEL_OPEN
- Must(store.Channel().Save(utils.T, &o1))
+ Must(store.Channel().Save(&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(utils.T, &o2))
+ Must(store.Channel().Save(&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(utils.T, &o3))
+ Must(store.Channel().Save(&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(utils.T, &o4))
+ Must(store.Channel().Save(&o4))
m1 := model.ChannelMember{}
m1.ChannelId = o1.Id
m1.UserId = model.NewId()
m1.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(utils.T, &m1))
+ Must(store.Channel().SaveMember(&m1))
m2 := model.ChannelMember{}
m2.ChannelId = o2.Id
m2.UserId = m1.UserId
m2.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(utils.T, &m2))
+ Must(store.Channel().SaveMember(&m2))
- if r := <-store.Channel().Delete(utils.T, o1.Id, model.GetMillis()); r.Err != nil {
+ if r := <-store.Channel().Delete(o1.Id, model.GetMillis()); r.Err != nil {
t.Fatal(r.Err)
}
- if r := <-store.Channel().Get(utils.T, o1.Id); r.Data.(*model.Channel).DeleteAt == 0 {
+ if r := <-store.Channel().Get(o1.Id); r.Data.(*model.Channel).DeleteAt == 0 {
t.Fatal("should have been deleted")
}
- if r := <-store.Channel().Delete(utils.T, o3.Id, model.GetMillis()); r.Err != nil {
+ if r := <-store.Channel().Delete(o3.Id, model.GetMillis()); r.Err != nil {
t.Fatal(r.Err)
}
- cresult := <-store.Channel().GetChannels(utils.T, o1.TeamId, m1.UserId)
+ cresult := <-store.Channel().GetChannels(o1.TeamId, m1.UserId)
list := cresult.Data.(*model.ChannelList)
if len(list.Channels) != 1 {
t.Fatal("invalid number of channels")
}
- cresult = <-store.Channel().GetMoreChannels(utils.T, o1.TeamId, m1.UserId)
+ cresult = <-store.Channel().GetMoreChannels(o1.TeamId, m1.UserId)
list = cresult.Data.(*model.ChannelList)
if len(list.Channels) != 1 {
@@ -281,9 +280,9 @@ func TestChannelStoreGetByName(t *testing.T) {
o1.DisplayName = "Name"
o1.Name = "a" + model.NewId() + "b"
o1.Type = model.CHANNEL_OPEN
- Must(store.Channel().Save(utils.T, &o1))
+ Must(store.Channel().Save(&o1))
- if r1 := <-store.Channel().GetByName(utils.T, o1.TeamId, o1.Name); r1.Err != nil {
+ if r1 := <-store.Channel().GetByName(o1.TeamId, o1.Name); r1.Err != nil {
t.Fatal(r1.Err)
} else {
if r1.Data.(*model.Channel).ToJson() != o1.ToJson() {
@@ -291,7 +290,7 @@ func TestChannelStoreGetByName(t *testing.T) {
}
}
- if err := (<-store.Channel().GetByName(utils.T, o1.TeamId, "")).Err; err == nil {
+ if err := (<-store.Channel().GetByName(o1.TeamId, "")).Err; err == nil {
t.Fatal("Missing id should have failed")
}
}
@@ -304,76 +303,76 @@ func TestChannelMemberStore(t *testing.T) {
c1.DisplayName = "NameName"
c1.Name = "a" + model.NewId() + "b"
c1.Type = model.CHANNEL_OPEN
- c1 = *Must(store.Channel().Save(utils.T, &c1)).(*model.Channel)
+ c1 = *Must(store.Channel().Save(&c1)).(*model.Channel)
- c1t1 := (<-store.Channel().Get(utils.T, c1.Id)).Data.(*model.Channel)
+ c1t1 := (<-store.Channel().Get(c1.Id)).Data.(*model.Channel)
t1 := c1t1.ExtraUpdateAt
u1 := model.User{}
u1.TeamId = model.NewId()
u1.Email = model.NewId()
u1.Nickname = model.NewId()
- Must(store.User().Save(utils.T, &u1))
+ Must(store.User().Save(&u1))
u2 := model.User{}
u2.TeamId = model.NewId()
u2.Email = model.NewId()
u2.Nickname = model.NewId()
- Must(store.User().Save(utils.T, &u2))
+ Must(store.User().Save(&u2))
o1 := model.ChannelMember{}
o1.ChannelId = c1.Id
o1.UserId = u1.Id
o1.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(utils.T, &o1))
+ Must(store.Channel().SaveMember(&o1))
o2 := model.ChannelMember{}
o2.ChannelId = c1.Id
o2.UserId = u2.Id
o2.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(utils.T, &o2))
+ Must(store.Channel().SaveMember(&o2))
- c1t2 := (<-store.Channel().Get(utils.T, c1.Id)).Data.(*model.Channel)
+ c1t2 := (<-store.Channel().Get(c1.Id)).Data.(*model.Channel)
t2 := c1t2.ExtraUpdateAt
if t2 <= t1 {
t.Fatal("Member update time incorrect")
}
- count := (<-store.Channel().GetMemberCount(utils.T, o1.ChannelId)).Data.(int64)
+ count := (<-store.Channel().GetMemberCount(o1.ChannelId)).Data.(int64)
if count != 2 {
t.Fatal("should have saved 2 members")
}
- Must(store.Channel().RemoveMember(utils.T, o2.ChannelId, o2.UserId))
+ Must(store.Channel().RemoveMember(o2.ChannelId, o2.UserId))
- count = (<-store.Channel().GetMemberCount(utils.T, o1.ChannelId)).Data.(int64)
+ count = (<-store.Channel().GetMemberCount(o1.ChannelId)).Data.(int64)
if count != 1 {
t.Fatal("should have removed 1 member")
}
- c1t3 := (<-store.Channel().Get(utils.T, c1.Id)).Data.(*model.Channel)
+ c1t3 := (<-store.Channel().Get(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(utils.T, o1.ChannelId, o1.UserId)).Data.(model.ChannelMember)
+ member := (<-store.Channel().GetMember(o1.ChannelId, o1.UserId)).Data.(model.ChannelMember)
if member.ChannelId != o1.ChannelId {
t.Fatal("should have go member")
}
- extraMembers := (<-store.Channel().GetExtraMembers(utils.T, o1.ChannelId, 20)).Data.([]model.ExtraMember)
+ extraMembers := (<-store.Channel().GetExtraMembers(o1.ChannelId, 20)).Data.([]model.ExtraMember)
if len(extraMembers) != 1 {
t.Fatal("should have 1 extra members")
}
- if err := (<-store.Channel().SaveMember(utils.T, &o1)).Err; err == nil {
+ if err := (<-store.Channel().SaveMember(&o1)).Err; err == nil {
t.Fatal("Should have been a duplicate")
}
- c1t4 := (<-store.Channel().Get(utils.T, c1.Id)).Data.(*model.Channel)
+ c1t4 := (<-store.Channel().Get(c1.Id)).Data.(*model.Channel)
t4 := c1t4.ExtraUpdateAt
if t4 != t3 {
t.Fatal("Should not update time upon failure")
@@ -388,50 +387,50 @@ func TestChannelDeleteMemberStore(t *testing.T) {
c1.DisplayName = "NameName"
c1.Name = "a" + model.NewId() + "b"
c1.Type = model.CHANNEL_OPEN
- c1 = *Must(store.Channel().Save(utils.T, &c1)).(*model.Channel)
+ c1 = *Must(store.Channel().Save(&c1)).(*model.Channel)
- c1t1 := (<-store.Channel().Get(utils.T, c1.Id)).Data.(*model.Channel)
+ c1t1 := (<-store.Channel().Get(c1.Id)).Data.(*model.Channel)
t1 := c1t1.ExtraUpdateAt
u1 := model.User{}
u1.TeamId = model.NewId()
u1.Email = model.NewId()
u1.Nickname = model.NewId()
- Must(store.User().Save(utils.T, &u1))
+ Must(store.User().Save(&u1))
u2 := model.User{}
u2.TeamId = model.NewId()
u2.Email = model.NewId()
u2.Nickname = model.NewId()
- Must(store.User().Save(utils.T, &u2))
+ Must(store.User().Save(&u2))
o1 := model.ChannelMember{}
o1.ChannelId = c1.Id
o1.UserId = u1.Id
o1.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(utils.T, &o1))
+ Must(store.Channel().SaveMember(&o1))
o2 := model.ChannelMember{}
o2.ChannelId = c1.Id
o2.UserId = u2.Id
o2.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(utils.T, &o2))
+ Must(store.Channel().SaveMember(&o2))
- c1t2 := (<-store.Channel().Get(utils.T, c1.Id)).Data.(*model.Channel)
+ c1t2 := (<-store.Channel().Get(c1.Id)).Data.(*model.Channel)
t2 := c1t2.ExtraUpdateAt
if t2 <= t1 {
t.Fatal("Member update time incorrect")
}
- count := (<-store.Channel().GetMemberCount(utils.T, o1.ChannelId)).Data.(int64)
+ count := (<-store.Channel().GetMemberCount(o1.ChannelId)).Data.(int64)
if count != 2 {
t.Fatal("should have saved 2 members")
}
- Must(store.Channel().PermanentDeleteMembersByUser(utils.T, o2.UserId))
+ Must(store.Channel().PermanentDeleteMembersByUser(o2.UserId))
- count = (<-store.Channel().GetMemberCount(utils.T, o1.ChannelId)).Data.(int64)
+ count = (<-store.Channel().GetMemberCount(o1.ChannelId)).Data.(int64)
if count != 1 {
t.Fatal("should have removed 1 member")
}
@@ -445,40 +444,40 @@ func TestChannelStorePermissionsTo(t *testing.T) {
o1.DisplayName = "Channel1"
o1.Name = "a" + model.NewId() + "b"
o1.Type = model.CHANNEL_OPEN
- Must(store.Channel().Save(utils.T, &o1))
+ Must(store.Channel().Save(&o1))
m1 := model.ChannelMember{}
m1.ChannelId = o1.Id
m1.UserId = model.NewId()
m1.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(utils.T, &m1))
+ Must(store.Channel().SaveMember(&m1))
- count := (<-store.Channel().CheckPermissionsTo(utils.T, o1.TeamId, o1.Id, m1.UserId)).Data.(int64)
+ count := (<-store.Channel().CheckPermissionsTo(o1.TeamId, o1.Id, m1.UserId)).Data.(int64)
if count != 1 {
t.Fatal("should have permissions")
}
- count = (<-store.Channel().CheckPermissionsTo(utils.T, "junk", o1.Id, m1.UserId)).Data.(int64)
+ count = (<-store.Channel().CheckPermissionsTo("junk", o1.Id, m1.UserId)).Data.(int64)
if count != 0 {
t.Fatal("shouldn't have permissions")
}
- count = (<-store.Channel().CheckPermissionsTo(utils.T, o1.TeamId, "junk", m1.UserId)).Data.(int64)
+ count = (<-store.Channel().CheckPermissionsTo(o1.TeamId, "junk", m1.UserId)).Data.(int64)
if count != 0 {
t.Fatal("shouldn't have permissions")
}
- count = (<-store.Channel().CheckPermissionsTo(utils.T, o1.TeamId, o1.Id, "junk")).Data.(int64)
+ count = (<-store.Channel().CheckPermissionsTo(o1.TeamId, o1.Id, "junk")).Data.(int64)
if count != 0 {
t.Fatal("shouldn't have permissions")
}
- channelId := (<-store.Channel().CheckPermissionsToByName(utils.T, o1.TeamId, o1.Name, m1.UserId)).Data.(string)
+ channelId := (<-store.Channel().CheckPermissionsToByName(o1.TeamId, o1.Name, m1.UserId)).Data.(string)
if channelId != o1.Id {
t.Fatal("should have permissions")
}
- channelId = (<-store.Channel().CheckPermissionsToByName(utils.T, o1.TeamId, "missing", m1.UserId)).Data.(string)
+ channelId = (<-store.Channel().CheckPermissionsToByName(o1.TeamId, "missing", m1.UserId)).Data.(string)
if channelId != "" {
t.Fatal("should not have permissions")
}
@@ -492,19 +491,19 @@ func TestChannelStoreOpenChannelPermissionsTo(t *testing.T) {
o1.DisplayName = "Channel1"
o1.Name = "a" + model.NewId() + "b"
o1.Type = model.CHANNEL_OPEN
- Must(store.Channel().Save(utils.T, &o1))
+ Must(store.Channel().Save(&o1))
- count := (<-store.Channel().CheckOpenChannelPermissions(utils.T, o1.TeamId, o1.Id)).Data.(int64)
+ count := (<-store.Channel().CheckOpenChannelPermissions(o1.TeamId, o1.Id)).Data.(int64)
if count != 1 {
t.Fatal("should have permissions")
}
- count = (<-store.Channel().CheckOpenChannelPermissions(utils.T, "junk", o1.Id)).Data.(int64)
+ count = (<-store.Channel().CheckOpenChannelPermissions("junk", o1.Id)).Data.(int64)
if count != 0 {
t.Fatal("shouldn't have permissions")
}
- count = (<-store.Channel().CheckOpenChannelPermissions(utils.T, o1.TeamId, "junk")).Data.(int64)
+ count = (<-store.Channel().CheckOpenChannelPermissions(o1.TeamId, "junk")).Data.(int64)
if count != 0 {
t.Fatal("shouldn't have permissions")
}
@@ -518,34 +517,34 @@ func TestChannelStoreGetChannels(t *testing.T) {
o2.DisplayName = "Channel2"
o2.Name = "a" + model.NewId() + "b"
o2.Type = model.CHANNEL_OPEN
- Must(store.Channel().Save(utils.T, &o2))
+ Must(store.Channel().Save(&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(utils.T, &o1))
+ Must(store.Channel().Save(&o1))
m1 := model.ChannelMember{}
m1.ChannelId = o1.Id
m1.UserId = model.NewId()
m1.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(utils.T, &m1))
+ Must(store.Channel().SaveMember(&m1))
m2 := model.ChannelMember{}
m2.ChannelId = o1.Id
m2.UserId = model.NewId()
m2.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(utils.T, &m2))
+ Must(store.Channel().SaveMember(&m2))
m3 := model.ChannelMember{}
m3.ChannelId = o2.Id
m3.UserId = model.NewId()
m3.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(utils.T, &m3))
+ Must(store.Channel().SaveMember(&m3))
- cresult := <-store.Channel().GetChannels(utils.T, o1.TeamId, m1.UserId)
+ cresult := <-store.Channel().GetChannels(o1.TeamId, m1.UserId)
list := cresult.Data.(*model.ChannelList)
if list.Channels[0].Id != o1.Id {
@@ -561,55 +560,55 @@ func TestChannelStoreGetMoreChannels(t *testing.T) {
o1.DisplayName = "Channel1"
o1.Name = "a" + model.NewId() + "b"
o1.Type = model.CHANNEL_OPEN
- Must(store.Channel().Save(utils.T, &o1))
+ Must(store.Channel().Save(&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(utils.T, &o2))
+ Must(store.Channel().Save(&o2))
m1 := model.ChannelMember{}
m1.ChannelId = o1.Id
m1.UserId = model.NewId()
m1.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(utils.T, &m1))
+ Must(store.Channel().SaveMember(&m1))
m2 := model.ChannelMember{}
m2.ChannelId = o1.Id
m2.UserId = model.NewId()
m2.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(utils.T, &m2))
+ Must(store.Channel().SaveMember(&m2))
m3 := model.ChannelMember{}
m3.ChannelId = o2.Id
m3.UserId = model.NewId()
m3.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(utils.T, &m3))
+ Must(store.Channel().SaveMember(&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(utils.T, &o3))
+ Must(store.Channel().Save(&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(utils.T, &o4))
+ Must(store.Channel().Save(&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(utils.T, &o5))
+ Must(store.Channel().Save(&o5))
- cresult := <-store.Channel().GetMoreChannels(utils.T, o1.TeamId, m1.UserId)
+ cresult := <-store.Channel().GetMoreChannels(o1.TeamId, m1.UserId)
list := cresult.Data.(*model.ChannelList)
if len(list.Channels) != 1 {
@@ -620,7 +619,7 @@ func TestChannelStoreGetMoreChannels(t *testing.T) {
t.Fatal("missing channel")
}
- if r1 := <-store.Channel().AnalyticsTypeCount(utils.T, o1.TeamId, model.CHANNEL_OPEN); r1.Err != nil {
+ if r1 := <-store.Channel().AnalyticsTypeCount(o1.TeamId, model.CHANNEL_OPEN); r1.Err != nil {
t.Fatal(r1.Err)
} else {
if r1.Data.(int64) != 2 {
@@ -629,7 +628,7 @@ func TestChannelStoreGetMoreChannels(t *testing.T) {
}
}
- if r1 := <-store.Channel().AnalyticsTypeCount(utils.T, o1.TeamId, model.CHANNEL_PRIVATE); r1.Err != nil {
+ if r1 := <-store.Channel().AnalyticsTypeCount(o1.TeamId, model.CHANNEL_PRIVATE); r1.Err != nil {
t.Fatal(r1.Err)
} else {
if r1.Data.(int64) != 2 {
@@ -647,34 +646,34 @@ func TestChannelStoreGetChannelCounts(t *testing.T) {
o2.DisplayName = "Channel2"
o2.Name = "a" + model.NewId() + "b"
o2.Type = model.CHANNEL_OPEN
- Must(store.Channel().Save(utils.T, &o2))
+ Must(store.Channel().Save(&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(utils.T, &o1))
+ Must(store.Channel().Save(&o1))
m1 := model.ChannelMember{}
m1.ChannelId = o1.Id
m1.UserId = model.NewId()
m1.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(utils.T, &m1))
+ Must(store.Channel().SaveMember(&m1))
m2 := model.ChannelMember{}
m2.ChannelId = o1.Id
m2.UserId = model.NewId()
m2.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(utils.T, &m2))
+ Must(store.Channel().SaveMember(&m2))
m3 := model.ChannelMember{}
m3.ChannelId = o2.Id
m3.UserId = model.NewId()
m3.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(utils.T, &m3))
+ Must(store.Channel().SaveMember(&m3))
- cresult := <-store.Channel().GetChannelCounts(utils.T, o1.TeamId, m1.UserId)
+ cresult := <-store.Channel().GetChannelCounts(o1.TeamId, m1.UserId)
counts := cresult.Data.(*model.ChannelCounts)
if len(counts.Counts) != 1 {
@@ -695,20 +694,20 @@ func TestChannelStoreUpdateLastViewedAt(t *testing.T) {
o1.Name = "a" + model.NewId() + "b"
o1.Type = model.CHANNEL_OPEN
o1.TotalMsgCount = 25
- Must(store.Channel().Save(utils.T, &o1))
+ Must(store.Channel().Save(&o1))
m1 := model.ChannelMember{}
m1.ChannelId = o1.Id
m1.UserId = model.NewId()
m1.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(utils.T, &m1))
+ Must(store.Channel().SaveMember(&m1))
- err := (<-store.Channel().UpdateLastViewedAt(utils.T, m1.ChannelId, m1.UserId)).Err
+ err := (<-store.Channel().UpdateLastViewedAt(m1.ChannelId, m1.UserId)).Err
if err != nil {
t.Fatal("failed to update", err)
}
- err = (<-store.Channel().UpdateLastViewedAt(utils.T, m1.ChannelId, "missing id")).Err
+ err = (<-store.Channel().UpdateLastViewedAt(m1.ChannelId, "missing id")).Err
if err != nil {
t.Fatal("failed to update")
}
@@ -723,30 +722,30 @@ func TestChannelStoreIncrementMentionCount(t *testing.T) {
o1.Name = "a" + model.NewId() + "b"
o1.Type = model.CHANNEL_OPEN
o1.TotalMsgCount = 25
- Must(store.Channel().Save(utils.T, &o1))
+ Must(store.Channel().Save(&o1))
m1 := model.ChannelMember{}
m1.ChannelId = o1.Id
m1.UserId = model.NewId()
m1.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(utils.T, &m1))
+ Must(store.Channel().SaveMember(&m1))
- err := (<-store.Channel().IncrementMentionCount(utils.T, m1.ChannelId, m1.UserId)).Err
+ err := (<-store.Channel().IncrementMentionCount(m1.ChannelId, m1.UserId)).Err
if err != nil {
t.Fatal("failed to update")
}
- err = (<-store.Channel().IncrementMentionCount(utils.T, m1.ChannelId, "missing id")).Err
+ err = (<-store.Channel().IncrementMentionCount(m1.ChannelId, "missing id")).Err
if err != nil {
t.Fatal("failed to update")
}
- err = (<-store.Channel().IncrementMentionCount(utils.T, "missing id", m1.UserId)).Err
+ err = (<-store.Channel().IncrementMentionCount("missing id", m1.UserId)).Err
if err != nil {
t.Fatal("failed to update")
}
- err = (<-store.Channel().IncrementMentionCount(utils.T, "missing id", "missing id")).Err
+ err = (<-store.Channel().IncrementMentionCount("missing id", "missing id")).Err
if err != nil {
t.Fatal("failed to update")
}
diff --git a/store/sql_oauth_store.go b/store/sql_oauth_store.go
index 20184e6a4..43a5bee31 100644
--- a/store/sql_oauth_store.go
+++ b/store/sql_oauth_store.go
@@ -5,7 +5,6 @@ package store
import (
"github.com/mattermost/platform/model"
- goi18n "github.com/nicksnyder/go-i18n/i18n"
"strings"
)
@@ -53,7 +52,7 @@ func (as SqlOAuthStore) CreateIndexesIfNotExists() {
as.CreateIndexIfNotExists("idx_oauthauthdata_client_id", "OAuthAuthData", "Code")
}
-func (as SqlOAuthStore) SaveApp(T goi18n.TranslateFunc, app *model.OAuthApp) StoreChannel {
+func (as SqlOAuthStore) SaveApp(app *model.OAuthApp) StoreChannel {
storeChannel := make(StoreChannel)
@@ -87,7 +86,7 @@ func (as SqlOAuthStore) SaveApp(T goi18n.TranslateFunc, app *model.OAuthApp) Sto
return storeChannel
}
-func (as SqlOAuthStore) UpdateApp(T goi18n.TranslateFunc, app *model.OAuthApp) StoreChannel {
+func (as SqlOAuthStore) UpdateApp(app *model.OAuthApp) StoreChannel {
storeChannel := make(StoreChannel)
@@ -128,7 +127,7 @@ func (as SqlOAuthStore) UpdateApp(T goi18n.TranslateFunc, app *model.OAuthApp) S
return storeChannel
}
-func (as SqlOAuthStore) GetApp(T goi18n.TranslateFunc, id string) StoreChannel {
+func (as SqlOAuthStore) GetApp(id string) StoreChannel {
storeChannel := make(StoreChannel)
@@ -151,7 +150,7 @@ func (as SqlOAuthStore) GetApp(T goi18n.TranslateFunc, id string) StoreChannel {
return storeChannel
}
-func (as SqlOAuthStore) GetAppByUser(T goi18n.TranslateFunc, userId string) StoreChannel {
+func (as SqlOAuthStore) GetAppByUser(userId string) StoreChannel {
storeChannel := make(StoreChannel)
@@ -173,7 +172,7 @@ func (as SqlOAuthStore) GetAppByUser(T goi18n.TranslateFunc, userId string) Stor
return storeChannel
}
-func (as SqlOAuthStore) SaveAccessData(T goi18n.TranslateFunc, accessData *model.AccessData) StoreChannel {
+func (as SqlOAuthStore) SaveAccessData(accessData *model.AccessData) StoreChannel {
storeChannel := make(StoreChannel)
@@ -199,7 +198,7 @@ func (as SqlOAuthStore) SaveAccessData(T goi18n.TranslateFunc, accessData *model
return storeChannel
}
-func (as SqlOAuthStore) GetAccessData(T goi18n.TranslateFunc, token string) StoreChannel {
+func (as SqlOAuthStore) GetAccessData(token string) StoreChannel {
storeChannel := make(StoreChannel)
@@ -222,7 +221,7 @@ func (as SqlOAuthStore) GetAccessData(T goi18n.TranslateFunc, token string) Stor
return storeChannel
}
-func (as SqlOAuthStore) GetAccessDataByAuthCode(T goi18n.TranslateFunc, authCode string) StoreChannel {
+func (as SqlOAuthStore) GetAccessDataByAuthCode(authCode string) StoreChannel {
storeChannel := make(StoreChannel)
@@ -249,7 +248,7 @@ func (as SqlOAuthStore) GetAccessDataByAuthCode(T goi18n.TranslateFunc, authCode
return storeChannel
}
-func (as SqlOAuthStore) RemoveAccessData(T goi18n.TranslateFunc, token string) StoreChannel {
+func (as SqlOAuthStore) RemoveAccessData(token string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -266,7 +265,7 @@ func (as SqlOAuthStore) RemoveAccessData(T goi18n.TranslateFunc, token string) S
return storeChannel
}
-func (as SqlOAuthStore) SaveAuthData(T goi18n.TranslateFunc, authData *model.AuthData) StoreChannel {
+func (as SqlOAuthStore) SaveAuthData(authData *model.AuthData) StoreChannel {
storeChannel := make(StoreChannel)
@@ -293,7 +292,7 @@ func (as SqlOAuthStore) SaveAuthData(T goi18n.TranslateFunc, authData *model.Aut
return storeChannel
}
-func (as SqlOAuthStore) GetAuthData(T goi18n.TranslateFunc, code string) StoreChannel {
+func (as SqlOAuthStore) GetAuthData(code string) StoreChannel {
storeChannel := make(StoreChannel)
@@ -316,7 +315,7 @@ func (as SqlOAuthStore) GetAuthData(T goi18n.TranslateFunc, code string) StoreCh
return storeChannel
}
-func (as SqlOAuthStore) RemoveAuthData(T goi18n.TranslateFunc, code string) StoreChannel {
+func (as SqlOAuthStore) RemoveAuthData(code string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -334,7 +333,7 @@ func (as SqlOAuthStore) RemoveAuthData(T goi18n.TranslateFunc, code string) Stor
return storeChannel
}
-func (as SqlOAuthStore) PermanentDeleteAuthDataByUser(T goi18n.TranslateFunc, userId string) StoreChannel {
+func (as SqlOAuthStore) PermanentDeleteAuthDataByUser(userId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
diff --git a/store/sql_oauth_store_test.go b/store/sql_oauth_store_test.go
index f8d035a0c..c3f6ea7ac 100644
--- a/store/sql_oauth_store_test.go
+++ b/store/sql_oauth_store_test.go
@@ -5,7 +5,6 @@ package store
import (
"github.com/mattermost/platform/model"
- "github.com/mattermost/platform/utils"
"testing"
)
@@ -18,7 +17,7 @@ func TestOAuthStoreSaveApp(t *testing.T) {
a1.CallbackUrls = []string{"https://nowhere.com"}
a1.Homepage = "https://nowhere.com"
- if err := (<-store.OAuth().SaveApp(utils.T, &a1)).Err; err != nil {
+ if err := (<-store.OAuth().SaveApp(&a1)).Err; err != nil {
t.Fatal(err)
}
}
@@ -31,13 +30,13 @@ func TestOAuthStoreGetApp(t *testing.T) {
a1.Name = "TestApp" + model.NewId()
a1.CallbackUrls = []string{"https://nowhere.com"}
a1.Homepage = "https://nowhere.com"
- Must(store.OAuth().SaveApp(utils.T, &a1))
+ Must(store.OAuth().SaveApp(&a1))
- if err := (<-store.OAuth().GetApp(utils.T, a1.Id)).Err; err != nil {
+ if err := (<-store.OAuth().GetApp(a1.Id)).Err; err != nil {
t.Fatal(err)
}
- if err := (<-store.OAuth().GetAppByUser(utils.T, a1.CreatorId)).Err; err != nil {
+ if err := (<-store.OAuth().GetAppByUser(a1.CreatorId)).Err; err != nil {
t.Fatal(err)
}
}
@@ -50,13 +49,13 @@ func TestOAuthStoreUpdateApp(t *testing.T) {
a1.Name = "TestApp" + model.NewId()
a1.CallbackUrls = []string{"https://nowhere.com"}
a1.Homepage = "https://nowhere.com"
- Must(store.OAuth().SaveApp(utils.T, &a1))
+ Must(store.OAuth().SaveApp(&a1))
a1.CreateAt = 1
a1.ClientSecret = "pwd"
a1.CreatorId = "12345678901234567890123456"
a1.Name = "NewName"
- if result := <-store.OAuth().UpdateApp(utils.T, &a1); result.Err != nil {
+ if result := <-store.OAuth().UpdateApp(&a1); result.Err != nil {
t.Fatal(result.Err)
} else {
ua1 := (result.Data.([2]*model.OAuthApp)[0])
@@ -83,7 +82,7 @@ func TestOAuthStoreSaveAccessData(t *testing.T) {
a1.Token = model.NewId()
a1.RefreshToken = model.NewId()
- if err := (<-store.OAuth().SaveAccessData(utils.T, &a1)).Err; err != nil {
+ if err := (<-store.OAuth().SaveAccessData(&a1)).Err; err != nil {
t.Fatal(err)
}
}
@@ -95,9 +94,9 @@ func TestOAuthStoreGetAccessData(t *testing.T) {
a1.AuthCode = model.NewId()
a1.Token = model.NewId()
a1.RefreshToken = model.NewId()
- Must(store.OAuth().SaveAccessData(utils.T, &a1))
+ Must(store.OAuth().SaveAccessData(&a1))
- if result := <-store.OAuth().GetAccessData(utils.T, a1.Token); result.Err != nil {
+ if result := <-store.OAuth().GetAccessData(a1.Token); result.Err != nil {
t.Fatal(result.Err)
} else {
ra1 := result.Data.(*model.AccessData)
@@ -106,11 +105,11 @@ func TestOAuthStoreGetAccessData(t *testing.T) {
}
}
- if err := (<-store.OAuth().GetAccessDataByAuthCode(utils.T, a1.AuthCode)).Err; err != nil {
+ if err := (<-store.OAuth().GetAccessDataByAuthCode(a1.AuthCode)).Err; err != nil {
t.Fatal(err)
}
- if err := (<-store.OAuth().GetAccessDataByAuthCode(utils.T, "junk")).Err; err != nil {
+ if err := (<-store.OAuth().GetAccessDataByAuthCode("junk")).Err; err != nil {
t.Fatal(err)
}
}
@@ -122,13 +121,13 @@ func TestOAuthStoreRemoveAccessData(t *testing.T) {
a1.AuthCode = model.NewId()
a1.Token = model.NewId()
a1.RefreshToken = model.NewId()
- Must(store.OAuth().SaveAccessData(utils.T, &a1))
+ Must(store.OAuth().SaveAccessData(&a1))
- if err := (<-store.OAuth().RemoveAccessData(utils.T, a1.Token)).Err; err != nil {
+ if err := (<-store.OAuth().RemoveAccessData(a1.Token)).Err; err != nil {
t.Fatal(err)
}
- if result := <-store.OAuth().GetAccessDataByAuthCode(utils.T, a1.AuthCode); result.Err != nil {
+ if result := <-store.OAuth().GetAccessDataByAuthCode(a1.AuthCode); result.Err != nil {
t.Fatal(result.Err)
} else {
if result.Data != nil {
@@ -145,7 +144,7 @@ func TestOAuthStoreSaveAuthData(t *testing.T) {
a1.UserId = model.NewId()
a1.Code = model.NewId()
- if err := (<-store.OAuth().SaveAuthData(utils.T, &a1)).Err; err != nil {
+ if err := (<-store.OAuth().SaveAuthData(&a1)).Err; err != nil {
t.Fatal(err)
}
}
@@ -157,9 +156,9 @@ func TestOAuthStoreGetAuthData(t *testing.T) {
a1.ClientId = model.NewId()
a1.UserId = model.NewId()
a1.Code = model.NewId()
- Must(store.OAuth().SaveAuthData(utils.T, &a1))
+ Must(store.OAuth().SaveAuthData(&a1))
- if err := (<-store.OAuth().GetAuthData(utils.T, a1.Code)).Err; err != nil {
+ if err := (<-store.OAuth().GetAuthData(a1.Code)).Err; err != nil {
t.Fatal(err)
}
}
@@ -171,13 +170,13 @@ func TestOAuthStoreRemoveAuthData(t *testing.T) {
a1.ClientId = model.NewId()
a1.UserId = model.NewId()
a1.Code = model.NewId()
- Must(store.OAuth().SaveAuthData(utils.T, &a1))
+ Must(store.OAuth().SaveAuthData(&a1))
- if err := (<-store.OAuth().RemoveAuthData(utils.T, a1.Code)).Err; err != nil {
+ if err := (<-store.OAuth().RemoveAuthData(a1.Code)).Err; err != nil {
t.Fatal(err)
}
- if err := (<-store.OAuth().GetAuthData(utils.T, a1.Code)).Err; err == nil {
+ if err := (<-store.OAuth().GetAuthData(a1.Code)).Err; err == nil {
t.Fatal("should have errored - auth code removed")
}
}
@@ -189,9 +188,9 @@ func TestOAuthStoreRemoveAuthDataByUser(t *testing.T) {
a1.ClientId = model.NewId()
a1.UserId = model.NewId()
a1.Code = model.NewId()
- Must(store.OAuth().SaveAuthData(utils.T, &a1))
+ Must(store.OAuth().SaveAuthData(&a1))
- if err := (<-store.OAuth().PermanentDeleteAuthDataByUser(utils.T, a1.UserId)).Err; err != nil {
+ if err := (<-store.OAuth().PermanentDeleteAuthDataByUser(a1.UserId)).Err; err != nil {
t.Fatal(err)
}
}
diff --git a/store/sql_post_store.go b/store/sql_post_store.go
index b48406261..40dca9930 100644
--- a/store/sql_post_store.go
+++ b/store/sql_post_store.go
@@ -11,7 +11,6 @@ import (
"github.com/mattermost/platform/model"
"github.com/mattermost/platform/utils"
- goi18n "github.com/nicksnyder/go-i18n/i18n"
)
type SqlPostStore struct {
@@ -51,7 +50,7 @@ func (s SqlPostStore) CreateIndexesIfNotExists() {
s.CreateFullTextIndexIfNotExists("idx_posts_hashtags_txt", "Posts", "Hashtags")
}
-func (s SqlPostStore) Save(T goi18n.TranslateFunc, post *model.Post) StoreChannel {
+func (s SqlPostStore) Save(post *model.Post) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -98,7 +97,7 @@ func (s SqlPostStore) Save(T goi18n.TranslateFunc, post *model.Post) StoreChanne
return storeChannel
}
-func (s SqlPostStore) Update(T goi18n.TranslateFunc, oldPost *model.Post, newMessage string, newHashtags string) StoreChannel {
+func (s SqlPostStore) Update(oldPost *model.Post, newMessage string, newHashtags string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -143,7 +142,7 @@ func (s SqlPostStore) Update(T goi18n.TranslateFunc, oldPost *model.Post, newMes
return storeChannel
}
-func (s SqlPostStore) Get(T goi18n.TranslateFunc, id string) StoreChannel {
+func (s SqlPostStore) Get(id string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -189,7 +188,7 @@ type etagPosts struct {
UpdateAt int64
}
-func (s SqlPostStore) GetEtag(T goi18n.TranslateFunc, channelId string) StoreChannel {
+func (s SqlPostStore) GetEtag(channelId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -210,7 +209,7 @@ func (s SqlPostStore) GetEtag(T goi18n.TranslateFunc, channelId string) StoreCha
return storeChannel
}
-func (s SqlPostStore) Delete(T goi18n.TranslateFunc, postId string, time int64) StoreChannel {
+func (s SqlPostStore) Delete(postId string, time int64) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -228,7 +227,7 @@ func (s SqlPostStore) Delete(T goi18n.TranslateFunc, postId string, time int64)
return storeChannel
}
-func (s SqlPostStore) permanentDelete(T goi18n.TranslateFunc, postId string) StoreChannel {
+func (s SqlPostStore) permanentDelete(postId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -246,7 +245,7 @@ func (s SqlPostStore) permanentDelete(T goi18n.TranslateFunc, postId string) Sto
return storeChannel
}
-func (s SqlPostStore) permanentDeleteAllCommentByUser(T goi18n.TranslateFunc, userId string) StoreChannel {
+func (s SqlPostStore) permanentDeleteAllCommentByUser(userId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -264,14 +263,14 @@ func (s SqlPostStore) permanentDeleteAllCommentByUser(T goi18n.TranslateFunc, us
return storeChannel
}
-func (s SqlPostStore) PermanentDeleteByUser(T goi18n.TranslateFunc, userId string) StoreChannel {
+func (s SqlPostStore) PermanentDeleteByUser(userId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
result := StoreResult{}
// First attempt to delete all the comments for a user
- if r := <-s.permanentDeleteAllCommentByUser(T, userId); r.Err != nil {
+ if r := <-s.permanentDeleteAllCommentByUser(userId); r.Err != nil {
result.Err = r.Err
storeChannel <- result
close(storeChannel)
@@ -295,7 +294,7 @@ func (s SqlPostStore) PermanentDeleteByUser(T goi18n.TranslateFunc, userId strin
found = false
for _, id := range ids {
found = true
- if r := <-s.permanentDelete(T, id); r.Err != nil {
+ if r := <-s.permanentDelete(id); r.Err != nil {
result.Err = r.Err
storeChannel <- result
close(storeChannel)
@@ -321,7 +320,7 @@ func (s SqlPostStore) PermanentDeleteByUser(T goi18n.TranslateFunc, userId strin
return storeChannel
}
-func (s SqlPostStore) GetPosts(T goi18n.TranslateFunc, channelId string, offset int, limit int) StoreChannel {
+func (s SqlPostStore) GetPosts(channelId string, offset int, limit int) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -334,8 +333,8 @@ func (s SqlPostStore) GetPosts(T goi18n.TranslateFunc, channelId string, offset
return
}
- rpc := s.getRootPosts(T, channelId, offset, limit)
- cpc := s.getParentsPosts(T, channelId, offset, limit)
+ rpc := s.getRootPosts(channelId, offset, limit)
+ cpc := s.getParentsPosts(channelId, offset, limit)
if rpr := <-rpc; rpr.Err != nil {
result.Err = rpr.Err
@@ -368,7 +367,7 @@ func (s SqlPostStore) GetPosts(T goi18n.TranslateFunc, channelId string, offset
return storeChannel
}
-func (s SqlPostStore) GetPostsSince(T goi18n.TranslateFunc, channelId string, time int64) StoreChannel {
+func (s SqlPostStore) GetPostsSince(channelId string, time int64) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -426,15 +425,15 @@ func (s SqlPostStore) GetPostsSince(T goi18n.TranslateFunc, channelId string, ti
return storeChannel
}
-func (s SqlPostStore) GetPostsBefore(T goi18n.TranslateFunc, channelId string, postId string, numPosts int, offset int) StoreChannel {
- return s.getPostsAround(T, channelId, postId, numPosts, offset, true)
+func (s SqlPostStore) GetPostsBefore(channelId string, postId string, numPosts int, offset int) StoreChannel {
+ return s.getPostsAround(channelId, postId, numPosts, offset, true)
}
-func (s SqlPostStore) GetPostsAfter(T goi18n.TranslateFunc, channelId string, postId string, numPosts int, offset int) StoreChannel {
- return s.getPostsAround(T, channelId, postId, numPosts, offset, false)
+func (s SqlPostStore) GetPostsAfter(channelId string, postId string, numPosts int, offset int) StoreChannel {
+ return s.getPostsAround(channelId, postId, numPosts, offset, false)
}
-func (s SqlPostStore) getPostsAround(T goi18n.TranslateFunc, channelId string, postId string, numPosts int, offset int, before bool) StoreChannel {
+func (s SqlPostStore) getPostsAround(channelId string, postId string, numPosts int, offset int, before bool) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -524,7 +523,7 @@ func (s SqlPostStore) getPostsAround(T goi18n.TranslateFunc, channelId string, p
return storeChannel
}
-func (s SqlPostStore) getRootPosts(T goi18n.TranslateFunc, channelId string, offset int, limit int) StoreChannel {
+func (s SqlPostStore) getRootPosts(channelId string, offset int, limit int) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -545,7 +544,7 @@ func (s SqlPostStore) getRootPosts(T goi18n.TranslateFunc, channelId string, off
return storeChannel
}
-func (s SqlPostStore) getParentsPosts(T goi18n.TranslateFunc, channelId string, offset int, limit int) StoreChannel {
+func (s SqlPostStore) getParentsPosts(channelId string, offset int, limit int) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -601,7 +600,7 @@ var specialSearchChar = []string{
"@",
}
-func (s SqlPostStore) Search(T goi18n.TranslateFunc, teamId string, userId string, params *model.SearchParams) StoreChannel {
+func (s SqlPostStore) Search(teamId string, userId string, params *model.SearchParams) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -766,7 +765,7 @@ func (s SqlPostStore) Search(T goi18n.TranslateFunc, teamId string, userId strin
return storeChannel
}
-func (s SqlPostStore) GetForExport(T goi18n.TranslateFunc, channelId string) StoreChannel {
+func (s SqlPostStore) GetForExport(channelId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -790,7 +789,7 @@ func (s SqlPostStore) GetForExport(T goi18n.TranslateFunc, channelId string) Sto
return storeChannel
}
-func (s SqlPostStore) AnalyticsUserCountsWithPostsByDay(T goi18n.TranslateFunc, teamId string) StoreChannel {
+func (s SqlPostStore) AnalyticsUserCountsWithPostsByDay(teamId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -854,7 +853,7 @@ func (s SqlPostStore) AnalyticsUserCountsWithPostsByDay(T goi18n.TranslateFunc,
return storeChannel
}
-func (s SqlPostStore) AnalyticsPostCountsByDay(T goi18n.TranslateFunc, teamId string) StoreChannel {
+func (s SqlPostStore) AnalyticsPostCountsByDay(teamId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -919,7 +918,7 @@ func (s SqlPostStore) AnalyticsPostCountsByDay(T goi18n.TranslateFunc, teamId st
return storeChannel
}
-func (s SqlPostStore) AnalyticsPostCount(T goi18n.TranslateFunc, teamId string) StoreChannel {
+func (s SqlPostStore) AnalyticsPostCount(teamId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
diff --git a/store/sql_post_store_test.go b/store/sql_post_store_test.go
index 5144924be..a3e3e10dd 100644
--- a/store/sql_post_store_test.go
+++ b/store/sql_post_store_test.go
@@ -20,11 +20,11 @@ func TestPostStoreSave(t *testing.T) {
o1.UserId = model.NewId()
o1.Message = "a" + model.NewId() + "b"
- if err := (<-store.Post().Save(utils.T, &o1)).Err; err != nil {
+ if err := (<-store.Post().Save(&o1)).Err; err != nil {
t.Fatal("couldn't save item", err)
}
- if err := (<-store.Post().Save(utils.T, &o1)).Err; err == nil {
+ if err := (<-store.Post().Save(&o1)).Err; err == nil {
t.Fatal("shouldn't be able to update from save")
}
}
@@ -37,19 +37,19 @@ func TestPostStoreGet(t *testing.T) {
o1.UserId = model.NewId()
o1.Message = "a" + model.NewId() + "b"
- etag1 := (<-store.Post().GetEtag(utils.T, o1.ChannelId)).Data.(string)
+ etag1 := (<-store.Post().GetEtag(o1.ChannelId)).Data.(string)
if strings.Index(etag1, model.CurrentVersion+".0.") != 0 {
t.Fatal("Invalid Etag")
}
- o1 = (<-store.Post().Save(utils.T, o1)).Data.(*model.Post)
+ o1 = (<-store.Post().Save(o1)).Data.(*model.Post)
- etag2 := (<-store.Post().GetEtag(utils.T, o1.ChannelId)).Data.(string)
+ etag2 := (<-store.Post().GetEtag(o1.ChannelId)).Data.(string)
if strings.Index(etag2, model.CurrentVersion+"."+o1.Id) != 0 {
t.Fatal("Invalid Etag")
}
- if r1 := <-store.Post().Get(utils.T, o1.Id); r1.Err != nil {
+ if r1 := <-store.Post().Get(o1.Id); r1.Err != nil {
t.Fatal(r1.Err)
} else {
if r1.Data.(*model.PostList).Posts[o1.Id].CreateAt != o1.CreateAt {
@@ -57,7 +57,7 @@ func TestPostStoreGet(t *testing.T) {
}
}
- if err := (<-store.Post().Get(utils.T, "123")).Err; err == nil {
+ if err := (<-store.Post().Get("123")).Err; err == nil {
t.Fatal("Missing id should have failed")
}
}
@@ -69,7 +69,7 @@ func TestPostStoreUpdate(t *testing.T) {
o1.ChannelId = model.NewId()
o1.UserId = model.NewId()
o1.Message = "a" + model.NewId() + "AAAAAAAAAAA"
- o1 = (<-store.Post().Save(utils.T, o1)).Data.(*model.Post)
+ o1 = (<-store.Post().Save(o1)).Data.(*model.Post)
o2 := &model.Post{}
o2.ChannelId = o1.ChannelId
@@ -77,50 +77,50 @@ func TestPostStoreUpdate(t *testing.T) {
o2.Message = "a" + model.NewId() + "CCCCCCCCC"
o2.ParentId = o1.Id
o2.RootId = o1.Id
- o2 = (<-store.Post().Save(utils.T, o2)).Data.(*model.Post)
+ o2 = (<-store.Post().Save(o2)).Data.(*model.Post)
o3 := &model.Post{}
o3.ChannelId = o1.ChannelId
o3.UserId = model.NewId()
o3.Message = "a" + model.NewId() + "QQQQQQQQQQ"
- o3 = (<-store.Post().Save(utils.T, o3)).Data.(*model.Post)
+ o3 = (<-store.Post().Save(o3)).Data.(*model.Post)
- ro1 := (<-store.Post().Get(utils.T, o1.Id)).Data.(*model.PostList).Posts[o1.Id]
- ro2 := (<-store.Post().Get(utils.T, o1.Id)).Data.(*model.PostList).Posts[o2.Id]
- ro6 := (<-store.Post().Get(utils.T, o3.Id)).Data.(*model.PostList).Posts[o3.Id]
+ ro1 := (<-store.Post().Get(o1.Id)).Data.(*model.PostList).Posts[o1.Id]
+ ro2 := (<-store.Post().Get(o1.Id)).Data.(*model.PostList).Posts[o2.Id]
+ ro6 := (<-store.Post().Get(o3.Id)).Data.(*model.PostList).Posts[o3.Id]
if ro1.Message != o1.Message {
t.Fatal("Failed to save/get")
}
msg := o1.Message + "BBBBBBBBBB"
- if result := <-store.Post().Update(utils.T, ro1, msg, ""); result.Err != nil {
+ if result := <-store.Post().Update(ro1, msg, ""); result.Err != nil {
t.Fatal(result.Err)
}
msg2 := o2.Message + "DDDDDDD"
- if result := <-store.Post().Update(utils.T, ro2, msg2, ""); result.Err != nil {
+ if result := <-store.Post().Update(ro2, msg2, ""); result.Err != nil {
t.Fatal(result.Err)
}
msg3 := o3.Message + "WWWWWWW"
- if result := <-store.Post().Update(utils.T, ro6, msg3, "#hashtag"); result.Err != nil {
+ if result := <-store.Post().Update(ro6, msg3, "#hashtag"); result.Err != nil {
t.Fatal(result.Err)
}
- ro3 := (<-store.Post().Get(utils.T, o1.Id)).Data.(*model.PostList).Posts[o1.Id]
+ ro3 := (<-store.Post().Get(o1.Id)).Data.(*model.PostList).Posts[o1.Id]
if ro3.Message != msg {
t.Fatal("Failed to update/get")
}
- ro4 := (<-store.Post().Get(utils.T, o1.Id)).Data.(*model.PostList).Posts[o2.Id]
+ ro4 := (<-store.Post().Get(o1.Id)).Data.(*model.PostList).Posts[o2.Id]
if ro4.Message != msg2 {
t.Fatal("Failed to update/get")
}
- ro5 := (<-store.Post().Get(utils.T, o3.Id)).Data.(*model.PostList).Posts[o3.Id]
+ ro5 := (<-store.Post().Get(o3.Id)).Data.(*model.PostList).Posts[o3.Id]
if ro5.Message != msg3 && ro5.Hashtags != "#hashtag" {
t.Fatal("Failed to update/get")
@@ -136,14 +136,14 @@ func TestPostStoreDelete(t *testing.T) {
o1.UserId = model.NewId()
o1.Message = "a" + model.NewId() + "b"
- etag1 := (<-store.Post().GetEtag(utils.T, o1.ChannelId)).Data.(string)
+ etag1 := (<-store.Post().GetEtag(o1.ChannelId)).Data.(string)
if strings.Index(etag1, model.CurrentVersion+".0.") != 0 {
t.Fatal("Invalid Etag")
}
- o1 = (<-store.Post().Save(utils.T, o1)).Data.(*model.Post)
+ o1 = (<-store.Post().Save(o1)).Data.(*model.Post)
- if r1 := <-store.Post().Get(utils.T, o1.Id); r1.Err != nil {
+ if r1 := <-store.Post().Get(o1.Id); r1.Err != nil {
t.Fatal(r1.Err)
} else {
if r1.Data.(*model.PostList).Posts[o1.Id].CreateAt != o1.CreateAt {
@@ -151,16 +151,16 @@ func TestPostStoreDelete(t *testing.T) {
}
}
- if r2 := <-store.Post().Delete(utils.T, o1.Id, model.GetMillis()); r2.Err != nil {
+ if r2 := <-store.Post().Delete(o1.Id, model.GetMillis()); r2.Err != nil {
t.Fatal(r2.Err)
}
- if r3 := (<-store.Post().Get(utils.T, o1.Id)); r3.Err == nil {
+ if r3 := (<-store.Post().Get(o1.Id)); r3.Err == nil {
t.Log(r3.Data)
t.Fatal("Missing id should have failed")
}
- etag2 := (<-store.Post().GetEtag(utils.T, o1.ChannelId)).Data.(string)
+ etag2 := (<-store.Post().GetEtag(o1.ChannelId)).Data.(string)
if strings.Index(etag2, model.CurrentVersion+"."+o1.Id) != 0 {
t.Fatal("Invalid Etag")
}
@@ -173,7 +173,7 @@ func TestPostStoreDelete1Level(t *testing.T) {
o1.ChannelId = model.NewId()
o1.UserId = model.NewId()
o1.Message = "a" + model.NewId() + "b"
- o1 = (<-store.Post().Save(utils.T, o1)).Data.(*model.Post)
+ o1 = (<-store.Post().Save(o1)).Data.(*model.Post)
o2 := &model.Post{}
o2.ChannelId = o1.ChannelId
@@ -181,17 +181,17 @@ func TestPostStoreDelete1Level(t *testing.T) {
o2.Message = "a" + model.NewId() + "b"
o2.ParentId = o1.Id
o2.RootId = o1.Id
- o2 = (<-store.Post().Save(utils.T, o2)).Data.(*model.Post)
+ o2 = (<-store.Post().Save(o2)).Data.(*model.Post)
- if r2 := <-store.Post().Delete(utils.T, o1.Id, model.GetMillis()); r2.Err != nil {
+ if r2 := <-store.Post().Delete(o1.Id, model.GetMillis()); r2.Err != nil {
t.Fatal(r2.Err)
}
- if r3 := (<-store.Post().Get(utils.T, o1.Id)); r3.Err == nil {
+ if r3 := (<-store.Post().Get(o1.Id)); r3.Err == nil {
t.Fatal("Deleted id should have failed")
}
- if r4 := (<-store.Post().Get(utils.T, o2.Id)); r4.Err == nil {
+ if r4 := (<-store.Post().Get(o2.Id)); r4.Err == nil {
t.Fatal("Deleted id should have failed")
}
}
@@ -203,7 +203,7 @@ func TestPostStoreDelete2Level(t *testing.T) {
o1.ChannelId = model.NewId()
o1.UserId = model.NewId()
o1.Message = "a" + model.NewId() + "b"
- o1 = (<-store.Post().Save(utils.T, o1)).Data.(*model.Post)
+ o1 = (<-store.Post().Save(o1)).Data.(*model.Post)
o2 := &model.Post{}
o2.ChannelId = o1.ChannelId
@@ -211,7 +211,7 @@ func TestPostStoreDelete2Level(t *testing.T) {
o2.Message = "a" + model.NewId() + "b"
o2.ParentId = o1.Id
o2.RootId = o1.Id
- o2 = (<-store.Post().Save(utils.T, o2)).Data.(*model.Post)
+ o2 = (<-store.Post().Save(o2)).Data.(*model.Post)
o3 := &model.Post{}
o3.ChannelId = o1.ChannelId
@@ -219,31 +219,31 @@ func TestPostStoreDelete2Level(t *testing.T) {
o3.Message = "a" + model.NewId() + "b"
o3.ParentId = o2.Id
o3.RootId = o1.Id
- o3 = (<-store.Post().Save(utils.T, o3)).Data.(*model.Post)
+ o3 = (<-store.Post().Save(o3)).Data.(*model.Post)
o4 := &model.Post{}
o4.ChannelId = model.NewId()
o4.UserId = model.NewId()
o4.Message = "a" + model.NewId() + "b"
- o4 = (<-store.Post().Save(utils.T, o4)).Data.(*model.Post)
+ o4 = (<-store.Post().Save(o4)).Data.(*model.Post)
- if r2 := <-store.Post().Delete(utils.T, o1.Id, model.GetMillis()); r2.Err != nil {
+ if r2 := <-store.Post().Delete(o1.Id, model.GetMillis()); r2.Err != nil {
t.Fatal(r2.Err)
}
- if r3 := (<-store.Post().Get(utils.T, o1.Id)); r3.Err == nil {
+ if r3 := (<-store.Post().Get(o1.Id)); r3.Err == nil {
t.Fatal("Deleted id should have failed")
}
- if r4 := (<-store.Post().Get(utils.T, o2.Id)); r4.Err == nil {
+ if r4 := (<-store.Post().Get(o2.Id)); r4.Err == nil {
t.Fatal("Deleted id should have failed")
}
- if r5 := (<-store.Post().Get(utils.T, o3.Id)); r5.Err == nil {
+ if r5 := (<-store.Post().Get(o3.Id)); r5.Err == nil {
t.Fatal("Deleted id should have failed")
}
- if r6 := <-store.Post().Get(utils.T, o4.Id); r6.Err != nil {
+ if r6 := <-store.Post().Get(o4.Id); r6.Err != nil {
t.Fatal(r6.Err)
}
}
@@ -255,7 +255,7 @@ func TestPostStorePermDelete1Level(t *testing.T) {
o1.ChannelId = model.NewId()
o1.UserId = model.NewId()
o1.Message = "a" + model.NewId() + "b"
- o1 = (<-store.Post().Save(utils.T, o1)).Data.(*model.Post)
+ o1 = (<-store.Post().Save(o1)).Data.(*model.Post)
o2 := &model.Post{}
o2.ChannelId = o1.ChannelId
@@ -263,17 +263,17 @@ func TestPostStorePermDelete1Level(t *testing.T) {
o2.Message = "a" + model.NewId() + "b"
o2.ParentId = o1.Id
o2.RootId = o1.Id
- o2 = (<-store.Post().Save(utils.T, o2)).Data.(*model.Post)
+ o2 = (<-store.Post().Save(o2)).Data.(*model.Post)
- if r2 := <-store.Post().PermanentDeleteByUser(utils.T, o2.UserId); r2.Err != nil {
+ if r2 := <-store.Post().PermanentDeleteByUser(o2.UserId); r2.Err != nil {
t.Fatal(r2.Err)
}
- if r3 := (<-store.Post().Get(utils.T, o1.Id)); r3.Err != nil {
+ if r3 := (<-store.Post().Get(o1.Id)); r3.Err != nil {
t.Fatal("Deleted id shouldn't have failed")
}
- if r4 := (<-store.Post().Get(utils.T, o2.Id)); r4.Err == nil {
+ if r4 := (<-store.Post().Get(o2.Id)); r4.Err == nil {
t.Fatal("Deleted id should have failed")
}
}
@@ -285,7 +285,7 @@ func TestPostStorePermDelete1Level2(t *testing.T) {
o1.ChannelId = model.NewId()
o1.UserId = model.NewId()
o1.Message = "a" + model.NewId() + "b"
- o1 = (<-store.Post().Save(utils.T, o1)).Data.(*model.Post)
+ o1 = (<-store.Post().Save(o1)).Data.(*model.Post)
o2 := &model.Post{}
o2.ChannelId = o1.ChannelId
@@ -293,27 +293,27 @@ func TestPostStorePermDelete1Level2(t *testing.T) {
o2.Message = "a" + model.NewId() + "b"
o2.ParentId = o1.Id
o2.RootId = o1.Id
- o2 = (<-store.Post().Save(utils.T, o2)).Data.(*model.Post)
+ o2 = (<-store.Post().Save(o2)).Data.(*model.Post)
o3 := &model.Post{}
o3.ChannelId = model.NewId()
o3.UserId = model.NewId()
o3.Message = "a" + model.NewId() + "b"
- o3 = (<-store.Post().Save(utils.T, o3)).Data.(*model.Post)
+ o3 = (<-store.Post().Save(o3)).Data.(*model.Post)
- if r2 := <-store.Post().PermanentDeleteByUser(utils.T, o1.UserId); r2.Err != nil {
+ if r2 := <-store.Post().PermanentDeleteByUser(o1.UserId); r2.Err != nil {
t.Fatal(r2.Err)
}
- if r3 := (<-store.Post().Get(utils.T, o1.Id)); r3.Err == nil {
+ if r3 := (<-store.Post().Get(o1.Id)); r3.Err == nil {
t.Fatal("Deleted id should have failed")
}
- if r4 := (<-store.Post().Get(utils.T, o2.Id)); r4.Err == nil {
+ if r4 := (<-store.Post().Get(o2.Id)); r4.Err == nil {
t.Fatal("Deleted id should have failed")
}
- if r5 := (<-store.Post().Get(utils.T, o3.Id)); r5.Err != nil {
+ if r5 := (<-store.Post().Get(o3.Id)); r5.Err != nil {
t.Fatal("Deleted id shouldn't have failed")
}
}
@@ -325,7 +325,7 @@ func TestPostStoreGetWithChildren(t *testing.T) {
o1.ChannelId = model.NewId()
o1.UserId = model.NewId()
o1.Message = "a" + model.NewId() + "b"
- o1 = (<-store.Post().Save(utils.T, o1)).Data.(*model.Post)
+ o1 = (<-store.Post().Save(o1)).Data.(*model.Post)
o2 := &model.Post{}
o2.ChannelId = o1.ChannelId
@@ -333,7 +333,7 @@ func TestPostStoreGetWithChildren(t *testing.T) {
o2.Message = "a" + model.NewId() + "b"
o2.ParentId = o1.Id
o2.RootId = o1.Id
- o2 = (<-store.Post().Save(utils.T, o2)).Data.(*model.Post)
+ o2 = (<-store.Post().Save(o2)).Data.(*model.Post)
o3 := &model.Post{}
o3.ChannelId = o1.ChannelId
@@ -341,9 +341,9 @@ func TestPostStoreGetWithChildren(t *testing.T) {
o3.Message = "a" + model.NewId() + "b"
o3.ParentId = o2.Id
o3.RootId = o1.Id
- o3 = (<-store.Post().Save(utils.T, o3)).Data.(*model.Post)
+ o3 = (<-store.Post().Save(o3)).Data.(*model.Post)
- if r1 := <-store.Post().Get(utils.T, o1.Id); r1.Err != nil {
+ if r1 := <-store.Post().Get(o1.Id); r1.Err != nil {
t.Fatal(r1.Err)
} else {
pl := r1.Data.(*model.PostList)
@@ -352,9 +352,9 @@ func TestPostStoreGetWithChildren(t *testing.T) {
}
}
- Must(store.Post().Delete(utils.T, o3.Id, model.GetMillis()))
+ Must(store.Post().Delete(o3.Id, model.GetMillis()))
- if r2 := <-store.Post().Get(utils.T, o1.Id); r2.Err != nil {
+ if r2 := <-store.Post().Get(o1.Id); r2.Err != nil {
t.Fatal(r2.Err)
} else {
pl := r2.Data.(*model.PostList)
@@ -363,9 +363,9 @@ func TestPostStoreGetWithChildren(t *testing.T) {
}
}
- Must(store.Post().Delete(utils.T, o2.Id, model.GetMillis()))
+ Must(store.Post().Delete(o2.Id, model.GetMillis()))
- if r3 := <-store.Post().Get(utils.T, o1.Id); r3.Err != nil {
+ if r3 := <-store.Post().Get(o1.Id); r3.Err != nil {
t.Fatal(r3.Err)
} else {
pl := r3.Data.(*model.PostList)
@@ -382,7 +382,7 @@ func TestPostStoreGetPostsWtihDetails(t *testing.T) {
o1.ChannelId = model.NewId()
o1.UserId = model.NewId()
o1.Message = "a" + model.NewId() + "b"
- o1 = (<-store.Post().Save(utils.T, o1)).Data.(*model.Post)
+ o1 = (<-store.Post().Save(o1)).Data.(*model.Post)
time.Sleep(2 * time.Millisecond)
o2 := &model.Post{}
@@ -391,7 +391,7 @@ func TestPostStoreGetPostsWtihDetails(t *testing.T) {
o2.Message = "a" + model.NewId() + "b"
o2.ParentId = o1.Id
o2.RootId = o1.Id
- o2 = (<-store.Post().Save(utils.T, o2)).Data.(*model.Post)
+ o2 = (<-store.Post().Save(o2)).Data.(*model.Post)
time.Sleep(2 * time.Millisecond)
o2a := &model.Post{}
@@ -400,7 +400,7 @@ func TestPostStoreGetPostsWtihDetails(t *testing.T) {
o2a.Message = "a" + model.NewId() + "b"
o2a.ParentId = o1.Id
o2a.RootId = o1.Id
- o2a = (<-store.Post().Save(utils.T, o2a)).Data.(*model.Post)
+ o2a = (<-store.Post().Save(o2a)).Data.(*model.Post)
time.Sleep(2 * time.Millisecond)
o3 := &model.Post{}
@@ -409,14 +409,14 @@ func TestPostStoreGetPostsWtihDetails(t *testing.T) {
o3.Message = "a" + model.NewId() + "b"
o3.ParentId = o1.Id
o3.RootId = o1.Id
- o3 = (<-store.Post().Save(utils.T, o3)).Data.(*model.Post)
+ o3 = (<-store.Post().Save(o3)).Data.(*model.Post)
time.Sleep(2 * time.Millisecond)
o4 := &model.Post{}
o4.ChannelId = o1.ChannelId
o4.UserId = model.NewId()
o4.Message = "a" + model.NewId() + "b"
- o4 = (<-store.Post().Save(utils.T, o4)).Data.(*model.Post)
+ o4 = (<-store.Post().Save(o4)).Data.(*model.Post)
time.Sleep(2 * time.Millisecond)
o5 := &model.Post{}
@@ -425,9 +425,9 @@ func TestPostStoreGetPostsWtihDetails(t *testing.T) {
o5.Message = "a" + model.NewId() + "b"
o5.ParentId = o4.Id
o5.RootId = o4.Id
- o5 = (<-store.Post().Save(utils.T, o5)).Data.(*model.Post)
+ o5 = (<-store.Post().Save(o5)).Data.(*model.Post)
- r1 := (<-store.Post().GetPosts(utils.T, o1.ChannelId, 0, 4)).Data.(*model.PostList)
+ r1 := (<-store.Post().GetPosts(o1.ChannelId, 0, 4)).Data.(*model.PostList)
if r1.Order[0] != o5.Id {
t.Fatal("invalid order")
@@ -460,14 +460,14 @@ func TestPostStoreGetPostsBeforeAfter(t *testing.T) {
o0.ChannelId = model.NewId()
o0.UserId = model.NewId()
o0.Message = "a" + model.NewId() + "b"
- o0 = (<-store.Post().Save(utils.T, o0)).Data.(*model.Post)
+ o0 = (<-store.Post().Save(o0)).Data.(*model.Post)
time.Sleep(2 * time.Millisecond)
o1 := &model.Post{}
o1.ChannelId = model.NewId()
o1.UserId = model.NewId()
o1.Message = "a" + model.NewId() + "b"
- o1 = (<-store.Post().Save(utils.T, o1)).Data.(*model.Post)
+ o1 = (<-store.Post().Save(o1)).Data.(*model.Post)
time.Sleep(2 * time.Millisecond)
o2 := &model.Post{}
@@ -476,7 +476,7 @@ func TestPostStoreGetPostsBeforeAfter(t *testing.T) {
o2.Message = "a" + model.NewId() + "b"
o2.ParentId = o1.Id
o2.RootId = o1.Id
- o2 = (<-store.Post().Save(utils.T, o2)).Data.(*model.Post)
+ o2 = (<-store.Post().Save(o2)).Data.(*model.Post)
time.Sleep(2 * time.Millisecond)
o2a := &model.Post{}
@@ -485,7 +485,7 @@ func TestPostStoreGetPostsBeforeAfter(t *testing.T) {
o2a.Message = "a" + model.NewId() + "b"
o2a.ParentId = o1.Id
o2a.RootId = o1.Id
- o2a = (<-store.Post().Save(utils.T, o2a)).Data.(*model.Post)
+ o2a = (<-store.Post().Save(o2a)).Data.(*model.Post)
time.Sleep(2 * time.Millisecond)
o3 := &model.Post{}
@@ -494,14 +494,14 @@ func TestPostStoreGetPostsBeforeAfter(t *testing.T) {
o3.Message = "a" + model.NewId() + "b"
o3.ParentId = o1.Id
o3.RootId = o1.Id
- o3 = (<-store.Post().Save(utils.T, o3)).Data.(*model.Post)
+ o3 = (<-store.Post().Save(o3)).Data.(*model.Post)
time.Sleep(2 * time.Millisecond)
o4 := &model.Post{}
o4.ChannelId = o1.ChannelId
o4.UserId = model.NewId()
o4.Message = "a" + model.NewId() + "b"
- o4 = (<-store.Post().Save(utils.T, o4)).Data.(*model.Post)
+ o4 = (<-store.Post().Save(o4)).Data.(*model.Post)
time.Sleep(2 * time.Millisecond)
o5 := &model.Post{}
@@ -510,15 +510,15 @@ func TestPostStoreGetPostsBeforeAfter(t *testing.T) {
o5.Message = "a" + model.NewId() + "b"
o5.ParentId = o4.Id
o5.RootId = o4.Id
- o5 = (<-store.Post().Save(utils.T, o5)).Data.(*model.Post)
+ o5 = (<-store.Post().Save(o5)).Data.(*model.Post)
- r1 := (<-store.Post().GetPostsBefore(utils.T, o1.ChannelId, o1.Id, 4, 0)).Data.(*model.PostList)
+ r1 := (<-store.Post().GetPostsBefore(o1.ChannelId, o1.Id, 4, 0)).Data.(*model.PostList)
if len(r1.Posts) != 0 {
t.Fatal("Wrong size")
}
- r2 := (<-store.Post().GetPostsAfter(utils.T, o1.ChannelId, o1.Id, 4, 0)).Data.(*model.PostList)
+ r2 := (<-store.Post().GetPostsAfter(o1.ChannelId, o1.Id, 4, 0)).Data.(*model.PostList)
if r2.Order[0] != o4.Id {
t.Fatal("invalid order")
@@ -540,7 +540,7 @@ func TestPostStoreGetPostsBeforeAfter(t *testing.T) {
t.Fatal("wrong size")
}
- r3 := (<-store.Post().GetPostsBefore(utils.T, o3.ChannelId, o3.Id, 2, 0)).Data.(*model.PostList)
+ r3 := (<-store.Post().GetPostsBefore(o3.ChannelId, o3.Id, 2, 0)).Data.(*model.PostList)
if r3.Order[0] != o2a.Id {
t.Fatal("invalid order")
@@ -565,14 +565,14 @@ func TestPostStoreGetPostsSince(t *testing.T) {
o0.ChannelId = model.NewId()
o0.UserId = model.NewId()
o0.Message = "a" + model.NewId() + "b"
- o0 = (<-store.Post().Save(utils.T, o0)).Data.(*model.Post)
+ o0 = (<-store.Post().Save(o0)).Data.(*model.Post)
time.Sleep(2 * time.Millisecond)
o1 := &model.Post{}
o1.ChannelId = model.NewId()
o1.UserId = model.NewId()
o1.Message = "a" + model.NewId() + "b"
- o1 = (<-store.Post().Save(utils.T, o1)).Data.(*model.Post)
+ o1 = (<-store.Post().Save(o1)).Data.(*model.Post)
time.Sleep(2 * time.Millisecond)
o2 := &model.Post{}
@@ -581,7 +581,7 @@ func TestPostStoreGetPostsSince(t *testing.T) {
o2.Message = "a" + model.NewId() + "b"
o2.ParentId = o1.Id
o2.RootId = o1.Id
- o2 = (<-store.Post().Save(utils.T, o2)).Data.(*model.Post)
+ o2 = (<-store.Post().Save(o2)).Data.(*model.Post)
time.Sleep(2 * time.Millisecond)
o2a := &model.Post{}
@@ -590,7 +590,7 @@ func TestPostStoreGetPostsSince(t *testing.T) {
o2a.Message = "a" + model.NewId() + "b"
o2a.ParentId = o1.Id
o2a.RootId = o1.Id
- o2a = (<-store.Post().Save(utils.T, o2a)).Data.(*model.Post)
+ o2a = (<-store.Post().Save(o2a)).Data.(*model.Post)
time.Sleep(2 * time.Millisecond)
o3 := &model.Post{}
@@ -599,14 +599,14 @@ func TestPostStoreGetPostsSince(t *testing.T) {
o3.Message = "a" + model.NewId() + "b"
o3.ParentId = o1.Id
o3.RootId = o1.Id
- o3 = (<-store.Post().Save(utils.T, o3)).Data.(*model.Post)
+ o3 = (<-store.Post().Save(o3)).Data.(*model.Post)
time.Sleep(2 * time.Millisecond)
o4 := &model.Post{}
o4.ChannelId = o1.ChannelId
o4.UserId = model.NewId()
o4.Message = "a" + model.NewId() + "b"
- o4 = (<-store.Post().Save(utils.T, o4)).Data.(*model.Post)
+ o4 = (<-store.Post().Save(o4)).Data.(*model.Post)
time.Sleep(2 * time.Millisecond)
o5 := &model.Post{}
@@ -615,9 +615,9 @@ func TestPostStoreGetPostsSince(t *testing.T) {
o5.Message = "a" + model.NewId() + "b"
o5.ParentId = o4.Id
o5.RootId = o4.Id
- o5 = (<-store.Post().Save(utils.T, o5)).Data.(*model.Post)
+ o5 = (<-store.Post().Save(o5)).Data.(*model.Post)
- r1 := (<-store.Post().GetPostsSince(utils.T, o1.ChannelId, o1.CreateAt)).Data.(*model.PostList)
+ r1 := (<-store.Post().GetPostsSince(o1.ChannelId, o1.CreateAt)).Data.(*model.PostList)
if r1.Order[0] != o5.Id {
t.Fatal("invalid order")
@@ -655,103 +655,103 @@ func TestPostStoreSearch(t *testing.T) {
c1.DisplayName = "Channel1"
c1.Name = "a" + model.NewId() + "b"
c1.Type = model.CHANNEL_OPEN
- c1 = (<-store.Channel().Save(utils.T, c1)).Data.(*model.Channel)
+ c1 = (<-store.Channel().Save(c1)).Data.(*model.Channel)
m1 := model.ChannelMember{}
m1.ChannelId = c1.Id
m1.UserId = userId
m1.NotifyProps = model.GetDefaultChannelNotifyProps()
- Must(store.Channel().SaveMember(utils.T, &m1))
+ Must(store.Channel().SaveMember(&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(utils.T, c2)).Data.(*model.Channel)
+ c2 = (<-store.Channel().Save(c2)).Data.(*model.Channel)
o1 := &model.Post{}
o1.ChannelId = c1.Id
o1.UserId = model.NewId()
o1.Message = "corey mattermost new york"
- o1 = (<-store.Post().Save(utils.T, o1)).Data.(*model.Post)
+ o1 = (<-store.Post().Save(o1)).Data.(*model.Post)
o2 := &model.Post{}
o2.ChannelId = c1.Id
o2.UserId = model.NewId()
o2.Message = "New Jersey is where John is from"
- o2 = (<-store.Post().Save(utils.T, o2)).Data.(*model.Post)
+ o2 = (<-store.Post().Save(o2)).Data.(*model.Post)
o3 := &model.Post{}
o3.ChannelId = c2.Id
o3.UserId = model.NewId()
o3.Message = "New Jersey is where John is from corey new york"
- o3 = (<-store.Post().Save(utils.T, o3)).Data.(*model.Post)
+ o3 = (<-store.Post().Save(o3)).Data.(*model.Post)
o4 := &model.Post{}
o4.ChannelId = c1.Id
o4.UserId = model.NewId()
o4.Hashtags = "#hashtag"
o4.Message = "(message)blargh"
- o4 = (<-store.Post().Save(utils.T, o4)).Data.(*model.Post)
+ o4 = (<-store.Post().Save(o4)).Data.(*model.Post)
o5 := &model.Post{}
o5.ChannelId = c1.Id
o5.UserId = model.NewId()
o5.Hashtags = "#secret #howdy"
- o5 = (<-store.Post().Save(utils.T, o5)).Data.(*model.Post)
+ o5 = (<-store.Post().Save(o5)).Data.(*model.Post)
- r1 := (<-store.Post().Search(utils.T, teamId, userId, &model.SearchParams{Terms: "corey", IsHashtag: false})).Data.(*model.PostList)
+ r1 := (<-store.Post().Search(teamId, userId, &model.SearchParams{Terms: "corey", IsHashtag: false})).Data.(*model.PostList)
if len(r1.Order) != 1 || r1.Order[0] != o1.Id {
t.Fatal("returned wrong search result")
}
- r3 := (<-store.Post().Search(utils.T, teamId, userId, &model.SearchParams{Terms: "new", IsHashtag: false})).Data.(*model.PostList)
+ r3 := (<-store.Post().Search(teamId, userId, &model.SearchParams{Terms: "new", IsHashtag: false})).Data.(*model.PostList)
if len(r3.Order) != 2 || (r3.Order[0] != o1.Id && r3.Order[1] != o1.Id) {
t.Fatal("returned wrong search result")
}
- r4 := (<-store.Post().Search(utils.T, teamId, userId, &model.SearchParams{Terms: "john", IsHashtag: false})).Data.(*model.PostList)
+ r4 := (<-store.Post().Search(teamId, userId, &model.SearchParams{Terms: "john", IsHashtag: false})).Data.(*model.PostList)
if len(r4.Order) != 1 || r4.Order[0] != o2.Id {
t.Fatal("returned wrong search result")
}
- r5 := (<-store.Post().Search(utils.T, teamId, userId, &model.SearchParams{Terms: "matter*", IsHashtag: false})).Data.(*model.PostList)
+ r5 := (<-store.Post().Search(teamId, userId, &model.SearchParams{Terms: "matter*", IsHashtag: false})).Data.(*model.PostList)
if len(r5.Order) != 1 || r5.Order[0] != o1.Id {
t.Fatal("returned wrong search result")
}
- r6 := (<-store.Post().Search(utils.T, teamId, userId, &model.SearchParams{Terms: "#hashtag", IsHashtag: true})).Data.(*model.PostList)
+ r6 := (<-store.Post().Search(teamId, userId, &model.SearchParams{Terms: "#hashtag", IsHashtag: true})).Data.(*model.PostList)
if len(r6.Order) != 1 || r6.Order[0] != o4.Id {
t.Fatal("returned wrong search result")
}
- r7 := (<-store.Post().Search(utils.T, teamId, userId, &model.SearchParams{Terms: "#secret", IsHashtag: true})).Data.(*model.PostList)
+ r7 := (<-store.Post().Search(teamId, userId, &model.SearchParams{Terms: "#secret", IsHashtag: true})).Data.(*model.PostList)
if len(r7.Order) != 1 || r7.Order[0] != o5.Id {
t.Fatal("returned wrong search result")
}
- r8 := (<-store.Post().Search(utils.T, teamId, userId, &model.SearchParams{Terms: "@thisshouldmatchnothing", IsHashtag: true})).Data.(*model.PostList)
+ r8 := (<-store.Post().Search(teamId, userId, &model.SearchParams{Terms: "@thisshouldmatchnothing", IsHashtag: true})).Data.(*model.PostList)
if len(r8.Order) != 0 {
t.Fatal("returned wrong search result")
}
- r9 := (<-store.Post().Search(utils.T, teamId, userId, &model.SearchParams{Terms: "mattermost jersey", IsHashtag: false})).Data.(*model.PostList)
+ r9 := (<-store.Post().Search(teamId, userId, &model.SearchParams{Terms: "mattermost jersey", IsHashtag: false})).Data.(*model.PostList)
if len(r9.Order) != 2 {
t.Fatal("returned wrong search result")
}
- r10 := (<-store.Post().Search(utils.T, teamId, userId, &model.SearchParams{Terms: "matter* jer*", IsHashtag: false})).Data.(*model.PostList)
+ r10 := (<-store.Post().Search(teamId, userId, &model.SearchParams{Terms: "matter* jer*", IsHashtag: false})).Data.(*model.PostList)
if len(r10.Order) != 2 {
t.Fatal("returned wrong search result")
}
- r11 := (<-store.Post().Search(utils.T, teamId, userId, &model.SearchParams{Terms: "message blargh", IsHashtag: false})).Data.(*model.PostList)
+ r11 := (<-store.Post().Search(teamId, userId, &model.SearchParams{Terms: "message blargh", IsHashtag: false})).Data.(*model.PostList)
if len(r11.Order) != 1 {
t.Fatal("returned wrong search result")
}
- r12 := (<-store.Post().Search(utils.T, teamId, userId, &model.SearchParams{Terms: "blargh>", IsHashtag: false})).Data.(*model.PostList)
+ r12 := (<-store.Post().Search(teamId, userId, &model.SearchParams{Terms: "blargh>", IsHashtag: false})).Data.(*model.PostList)
if len(r12.Order) != 1 {
t.Fatal("returned wrong search result")
}
@@ -765,44 +765,44 @@ func TestUserCountsWithPostsByDay(t *testing.T) {
t1.Name = "a" + model.NewId() + "b"
t1.Email = model.NewId() + "@nowhere.com"
t1.Type = model.TEAM_OPEN
- t1 = Must(store.Team().Save(utils.T, t1)).(*model.Team)
+ t1 = Must(store.Team().Save(t1)).(*model.Team)
c1 := &model.Channel{}
c1.TeamId = t1.Id
c1.DisplayName = "Channel2"
c1.Name = "a" + model.NewId() + "b"
c1.Type = model.CHANNEL_OPEN
- c1 = Must(store.Channel().Save(utils.T, c1)).(*model.Channel)
+ c1 = Must(store.Channel().Save(c1)).(*model.Channel)
o1 := &model.Post{}
o1.ChannelId = c1.Id
o1.UserId = model.NewId()
o1.CreateAt = utils.MillisFromTime(utils.Yesterday())
o1.Message = "a" + model.NewId() + "b"
- o1 = Must(store.Post().Save(utils.T, o1)).(*model.Post)
+ o1 = Must(store.Post().Save(o1)).(*model.Post)
o1a := &model.Post{}
o1a.ChannelId = c1.Id
o1a.UserId = model.NewId()
o1a.CreateAt = o1.CreateAt
o1a.Message = "a" + model.NewId() + "b"
- o1a = Must(store.Post().Save(utils.T, o1a)).(*model.Post)
+ o1a = Must(store.Post().Save(o1a)).(*model.Post)
o2 := &model.Post{}
o2.ChannelId = c1.Id
o2.UserId = model.NewId()
o2.CreateAt = o1.CreateAt - (1000 * 60 * 60 * 24)
o2.Message = "a" + model.NewId() + "b"
- o2 = Must(store.Post().Save(utils.T, o2)).(*model.Post)
+ o2 = Must(store.Post().Save(o2)).(*model.Post)
o2a := &model.Post{}
o2a.ChannelId = c1.Id
o2a.UserId = o2.UserId
o2a.CreateAt = o1.CreateAt - (1000 * 60 * 60 * 24)
o2a.Message = "a" + model.NewId() + "b"
- o2a = Must(store.Post().Save(utils.T, o2a)).(*model.Post)
+ o2a = Must(store.Post().Save(o2a)).(*model.Post)
- if r1 := <-store.Post().AnalyticsUserCountsWithPostsByDay(utils.T, t1.Id); r1.Err != nil {
+ if r1 := <-store.Post().AnalyticsUserCountsWithPostsByDay(t1.Id); r1.Err != nil {
t.Fatal(r1.Err)
} else {
row1 := r1.Data.(model.AnalyticsRows)[0]
@@ -825,47 +825,47 @@ func TestPostCountsByDay(t *testing.T) {
t1.Name = "a" + model.NewId() + "b"
t1.Email = model.NewId() + "@nowhere.com"
t1.Type = model.TEAM_OPEN
- t1 = Must(store.Team().Save(utils.T, t1)).(*model.Team)
+ t1 = Must(store.Team().Save(t1)).(*model.Team)
c1 := &model.Channel{}
c1.TeamId = t1.Id
c1.DisplayName = "Channel2"
c1.Name = "a" + model.NewId() + "b"
c1.Type = model.CHANNEL_OPEN
- c1 = Must(store.Channel().Save(utils.T, c1)).(*model.Channel)
+ c1 = Must(store.Channel().Save(c1)).(*model.Channel)
o1 := &model.Post{}
o1.ChannelId = c1.Id
o1.UserId = model.NewId()
o1.CreateAt = utils.MillisFromTime(utils.Yesterday())
o1.Message = "a" + model.NewId() + "b"
- o1 = Must(store.Post().Save(utils.T, o1)).(*model.Post)
+ o1 = Must(store.Post().Save(o1)).(*model.Post)
o1a := &model.Post{}
o1a.ChannelId = c1.Id
o1a.UserId = model.NewId()
o1a.CreateAt = o1.CreateAt
o1a.Message = "a" + model.NewId() + "b"
- o1a = Must(store.Post().Save(utils.T, o1a)).(*model.Post)
+ o1a = Must(store.Post().Save(o1a)).(*model.Post)
o2 := &model.Post{}
o2.ChannelId = c1.Id
o2.UserId = model.NewId()
o2.CreateAt = o1.CreateAt - (1000 * 60 * 60 * 24 * 2)
o2.Message = "a" + model.NewId() + "b"
- o2 = Must(store.Post().Save(utils.T, o2)).(*model.Post)
+ o2 = Must(store.Post().Save(o2)).(*model.Post)
o2a := &model.Post{}
o2a.ChannelId = c1.Id
o2a.UserId = o2.UserId
o2a.CreateAt = o1.CreateAt - (1000 * 60 * 60 * 24 * 2)
o2a.Message = "a" + model.NewId() + "b"
- o2a = Must(store.Post().Save(utils.T, o2a)).(*model.Post)
+ o2a = Must(store.Post().Save(o2a)).(*model.Post)
time.Sleep(1 * time.Second)
t.Log(t1.Id)
- if r1 := <-store.Post().AnalyticsPostCountsByDay(utils.T, t1.Id); r1.Err != nil {
+ if r1 := <-store.Post().AnalyticsPostCountsByDay(t1.Id); r1.Err != nil {
t.Fatal(r1.Err)
} else {
row1 := r1.Data.(model.AnalyticsRows)[0]
@@ -880,7 +880,7 @@ func TestPostCountsByDay(t *testing.T) {
}
}
- if r1 := <-store.Post().AnalyticsPostCount(utils.T, t1.Id); r1.Err != nil {
+ if r1 := <-store.Post().AnalyticsPostCount(t1.Id); r1.Err != nil {
t.Fatal(r1.Err)
} else {
if r1.Data.(int64) != 4 {
diff --git a/store/sql_preference_store.go b/store/sql_preference_store.go
index 234396058..6302d2f4f 100644
--- a/store/sql_preference_store.go
+++ b/store/sql_preference_store.go
@@ -8,7 +8,6 @@ import (
"github.com/go-gorp/gorp"
"github.com/mattermost/platform/model"
"github.com/mattermost/platform/utils"
- goi18n "github.com/nicksnyder/go-i18n/i18n"
)
type SqlPreferenceStore struct {
@@ -42,7 +41,7 @@ func (s SqlPreferenceStore) CreateIndexesIfNotExists() {
s.CreateIndexIfNotExists("idx_preferences_name", "Preferences", "Name")
}
-func (s SqlPreferenceStore) DeleteUnusedFeatures(T goi18n.TranslateFunc) {
+func (s SqlPreferenceStore) DeleteUnusedFeatures() {
l4g.Debug("Deleting any unused pre-release features")
sql := `DELETE
@@ -59,7 +58,7 @@ func (s SqlPreferenceStore) DeleteUnusedFeatures(T goi18n.TranslateFunc) {
s.GetMaster().Exec(sql, queryParams)
}
-func (s SqlPreferenceStore) Save(T goi18n.TranslateFunc, preferences *model.Preferences) StoreChannel {
+func (s SqlPreferenceStore) Save(preferences *model.Preferences) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -71,7 +70,7 @@ func (s SqlPreferenceStore) Save(T goi18n.TranslateFunc, preferences *model.Pref
result.Err = model.NewAppError("SqlPreferenceStore.Save", "Unable to open transaction to save preferences", err.Error())
} else {
for _, preference := range *preferences {
- if upsertResult := s.save(T, transaction, &preference); upsertResult.Err != nil {
+ if upsertResult := s.save(transaction, &preference); upsertResult.Err != nil {
result = upsertResult
break
}
@@ -98,7 +97,7 @@ func (s SqlPreferenceStore) Save(T goi18n.TranslateFunc, preferences *model.Pref
return storeChannel
}
-func (s SqlPreferenceStore) save(T goi18n.TranslateFunc, transaction *gorp.Transaction, preference *model.Preference) StoreResult {
+func (s SqlPreferenceStore) save(transaction *gorp.Transaction, preference *model.Preference) StoreResult {
result := StoreResult{}
if result.Err = preference.IsValid(); result.Err != nil {
@@ -140,9 +139,9 @@ func (s SqlPreferenceStore) save(T goi18n.TranslateFunc, transaction *gorp.Trans
}
if count == 1 {
- s.update(T, transaction, preference)
+ s.update(transaction, preference)
} else {
- s.insert(T, transaction, preference)
+ s.insert(transaction, preference)
}
} else {
result.Err = model.NewAppError("SqlPreferenceStore.save", "We encountered an error while updating preferences",
@@ -152,7 +151,7 @@ func (s SqlPreferenceStore) save(T goi18n.TranslateFunc, transaction *gorp.Trans
return result
}
-func (s SqlPreferenceStore) insert(T goi18n.TranslateFunc, transaction *gorp.Transaction, preference *model.Preference) StoreResult {
+func (s SqlPreferenceStore) insert(transaction *gorp.Transaction, preference *model.Preference) StoreResult {
result := StoreResult{}
if err := transaction.Insert(preference); err != nil {
@@ -168,7 +167,7 @@ func (s SqlPreferenceStore) insert(T goi18n.TranslateFunc, transaction *gorp.Tra
return result
}
-func (s SqlPreferenceStore) update(T goi18n.TranslateFunc, transaction *gorp.Transaction, preference *model.Preference) StoreResult {
+func (s SqlPreferenceStore) update(transaction *gorp.Transaction, preference *model.Preference) StoreResult {
result := StoreResult{}
if _, err := transaction.Update(preference); err != nil {
@@ -179,7 +178,7 @@ func (s SqlPreferenceStore) update(T goi18n.TranslateFunc, transaction *gorp.Tra
return result
}
-func (s SqlPreferenceStore) Get(T goi18n.TranslateFunc, userId string, category string, name string) StoreChannel {
+func (s SqlPreferenceStore) Get(userId string, category string, name string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -208,7 +207,7 @@ func (s SqlPreferenceStore) Get(T goi18n.TranslateFunc, userId string, category
return storeChannel
}
-func (s SqlPreferenceStore) GetCategory(T goi18n.TranslateFunc, userId string, category string) StoreChannel {
+func (s SqlPreferenceStore) GetCategory(userId string, category string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -236,7 +235,7 @@ func (s SqlPreferenceStore) GetCategory(T goi18n.TranslateFunc, userId string, c
return storeChannel
}
-func (s SqlPreferenceStore) GetAll(T goi18n.TranslateFunc, userId string) StoreChannel {
+func (s SqlPreferenceStore) GetAll(userId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -263,7 +262,7 @@ func (s SqlPreferenceStore) GetAll(T goi18n.TranslateFunc, userId string) StoreC
return storeChannel
}
-func (s SqlPreferenceStore) PermanentDeleteByUser(T goi18n.TranslateFunc, userId string) StoreChannel {
+func (s SqlPreferenceStore) PermanentDeleteByUser(userId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -281,7 +280,7 @@ func (s SqlPreferenceStore) PermanentDeleteByUser(T goi18n.TranslateFunc, userId
return storeChannel
}
-func (s SqlPreferenceStore) IsFeatureEnabled(T goi18n.TranslateFunc, feature, userId string) StoreChannel {
+func (s SqlPreferenceStore) IsFeatureEnabled(feature, userId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
diff --git a/store/sql_preference_store_test.go b/store/sql_preference_store_test.go
index c93831b37..ec9d1df6c 100644
--- a/store/sql_preference_store_test.go
+++ b/store/sql_preference_store_test.go
@@ -5,7 +5,6 @@ package store
import (
"github.com/mattermost/platform/model"
- "github.com/mattermost/platform/utils"
"testing"
)
@@ -28,24 +27,24 @@ func TestPreferenceSave(t *testing.T) {
Value: "value1b",
},
}
- if count := Must(store.Preference().Save(utils.T, &preferences)); count != 2 {
+ if count := Must(store.Preference().Save(&preferences)); count != 2 {
t.Fatal("got incorrect number of rows saved")
}
for _, preference := range preferences {
- if data := Must(store.Preference().Get(utils.T, preference.UserId, preference.Category, preference.Name)).(model.Preference); preference != data {
+ if data := Must(store.Preference().Get(preference.UserId, preference.Category, preference.Name)).(model.Preference); preference != data {
t.Fatal("got incorrect preference after first Save")
}
}
preferences[0].Value = "value2a"
preferences[1].Value = "value2b"
- if count := Must(store.Preference().Save(utils.T, &preferences)); count != 2 {
+ if count := Must(store.Preference().Save(&preferences)); count != 2 {
t.Fatal("got incorrect number of rows saved")
}
for _, preference := range preferences {
- if data := Must(store.Preference().Get(utils.T, preference.UserId, preference.Category, preference.Name)).(model.Preference); preference != data {
+ if data := Must(store.Preference().Get(preference.UserId, preference.Category, preference.Name)).(model.Preference); preference != data {
t.Fatal("got incorrect preference after second Save")
}
}
@@ -81,16 +80,16 @@ func TestPreferenceGet(t *testing.T) {
},
}
- Must(store.Preference().Save(utils.T, &preferences))
+ Must(store.Preference().Save(&preferences))
- if result := <-store.Preference().Get(utils.T, userId, category, name); result.Err != nil {
+ if result := <-store.Preference().Get(userId, category, name); result.Err != nil {
t.Fatal(result.Err)
} else if data := result.Data.(model.Preference); data != preferences[0] {
t.Fatal("got incorrect preference")
}
// make sure getting a missing preference fails
- if result := <-store.Preference().Get(utils.T, model.NewId(), model.NewId(), model.NewId()); result.Err == nil {
+ if result := <-store.Preference().Get(model.NewId(), model.NewId(), model.NewId()); result.Err == nil {
t.Fatal("no error on getting a missing preference")
}
}
@@ -128,9 +127,9 @@ func TestPreferenceGetCategory(t *testing.T) {
},
}
- Must(store.Preference().Save(utils.T, &preferences))
+ Must(store.Preference().Save(&preferences))
- if result := <-store.Preference().GetCategory(utils.T, userId, category); result.Err != nil {
+ if result := <-store.Preference().GetCategory(userId, category); result.Err != nil {
t.Fatal(result.Err)
} else if data := result.Data.(model.Preferences); len(data) != 2 {
t.Fatal("got the wrong number of preferences")
@@ -139,7 +138,7 @@ func TestPreferenceGetCategory(t *testing.T) {
}
// make sure getting a missing preference category doesn't fail
- if result := <-store.Preference().GetCategory(utils.T, model.NewId(), model.NewId()); result.Err != nil {
+ if result := <-store.Preference().GetCategory(model.NewId(), model.NewId()); result.Err != nil {
t.Fatal(result.Err)
} else if data := result.Data.(model.Preferences); len(data) != 0 {
t.Fatal("shouldn't have got any preferences")
@@ -179,9 +178,9 @@ func TestPreferenceGetAll(t *testing.T) {
},
}
- Must(store.Preference().Save(utils.T, &preferences))
+ Must(store.Preference().Save(&preferences))
- if result := <-store.Preference().GetAll(utils.T, userId); result.Err != nil {
+ if result := <-store.Preference().GetAll(userId); result.Err != nil {
t.Fatal(result.Err)
} else if data := result.Data.(model.Preferences); len(data) != 3 {
t.Fatal("got the wrong number of preferences")
@@ -227,9 +226,9 @@ func TestPreferenceDelete(t *testing.T) {
},
}
- Must(store.Preference().Save(utils.T, &preferences))
+ Must(store.Preference().Save(&preferences))
- if result := <-store.Preference().PermanentDeleteByUser(utils.T, userId); result.Err != nil {
+ if result := <-store.Preference().PermanentDeleteByUser(userId); result.Err != nil {
t.Fatal(result.Err)
}
}
@@ -277,29 +276,29 @@ func TestIsFeatureEnabled(t *testing.T) {
},
}
- Must(store.Preference().Save(utils.T, &features))
+ Must(store.Preference().Save(&features))
- if result := <-store.Preference().IsFeatureEnabled(utils.T, feature1, userId); result.Err != nil {
+ if result := <-store.Preference().IsFeatureEnabled(feature1, userId); result.Err != nil {
t.Fatal(result.Err)
} else if data := result.Data.(bool); data != true {
t.Fatalf("got incorrect setting for feature1, %v=%v", true, data)
}
- if result := <-store.Preference().IsFeatureEnabled(utils.T, feature2, userId); result.Err != nil {
+ if result := <-store.Preference().IsFeatureEnabled(feature2, userId); result.Err != nil {
t.Fatal(result.Err)
} else if data := result.Data.(bool); data != false {
t.Fatalf("got incorrect setting for feature2, %v=%v", false, data)
}
// make sure we get false if something different than "true" or "false" has been saved to database
- if result := <-store.Preference().IsFeatureEnabled(utils.T, feature3, userId); result.Err != nil {
+ if result := <-store.Preference().IsFeatureEnabled(feature3, userId); result.Err != nil {
t.Fatal(result.Err)
} else if data := result.Data.(bool); data != false {
t.Fatalf("got incorrect setting for feature3, %v=%v", false, data)
}
// make sure false is returned if a non-existent feature is queried
- if result := <-store.Preference().IsFeatureEnabled(utils.T, "someOtherFeature", userId); result.Err != nil {
+ if result := <-store.Preference().IsFeatureEnabled("someOtherFeature", userId); result.Err != nil {
t.Fatal(result.Err)
} else if data := result.Data.(bool); data != false {
t.Fatalf("got incorrect setting for non-existent feature 'someOtherFeature', %v=%v", false, data)
@@ -342,9 +341,9 @@ func TestDeleteUnusedFeatures(t *testing.T) {
},
}
- Must(store.Preference().Save(utils.T, &features))
+ Must(store.Preference().Save(&features))
- store.(*SqlStore).preference.(*SqlPreferenceStore).DeleteUnusedFeatures(utils.T)
+ store.(*SqlStore).preference.(*SqlPreferenceStore).DeleteUnusedFeatures()
//make sure features with value "false" have actually been deleted from the database
if val, err := store.(*SqlStore).preference.(*SqlPreferenceStore).GetReplica().SelectInt(`SELECT COUNT(*)
diff --git a/store/sql_session_store.go b/store/sql_session_store.go
index e66b8529a..6b0a31443 100644
--- a/store/sql_session_store.go
+++ b/store/sql_session_store.go
@@ -6,7 +6,6 @@ package store
import (
l4g "github.com/alecthomas/log4go"
"github.com/mattermost/platform/model"
- goi18n "github.com/nicksnyder/go-i18n/i18n"
)
type SqlSessionStore struct {
@@ -38,7 +37,7 @@ func (me SqlSessionStore) CreateIndexesIfNotExists() {
me.CreateIndexIfNotExists("idx_sessions_token", "Sessions", "Token")
}
-func (me SqlSessionStore) Save(T goi18n.TranslateFunc, session *model.Session) StoreChannel {
+func (me SqlSessionStore) Save(session *model.Session) StoreChannel {
storeChannel := make(StoreChannel)
@@ -54,7 +53,7 @@ func (me SqlSessionStore) Save(T goi18n.TranslateFunc, session *model.Session) S
session.PreSave()
- if cur := <-me.CleanUpExpiredSessions(T, session.UserId); cur.Err != nil {
+ if cur := <-me.CleanUpExpiredSessions(session.UserId); cur.Err != nil {
l4g.Error("Failed to cleanup sessions in Save err=%v", cur.Err)
}
@@ -71,7 +70,7 @@ func (me SqlSessionStore) Save(T goi18n.TranslateFunc, session *model.Session) S
return storeChannel
}
-func (me SqlSessionStore) Get(T goi18n.TranslateFunc, sessionIdOrToken string) StoreChannel {
+func (me SqlSessionStore) Get(sessionIdOrToken string) StoreChannel {
storeChannel := make(StoreChannel)
@@ -96,12 +95,12 @@ func (me SqlSessionStore) Get(T goi18n.TranslateFunc, sessionIdOrToken string) S
return storeChannel
}
-func (me SqlSessionStore) GetSessions(T goi18n.TranslateFunc, userId string) StoreChannel {
+func (me SqlSessionStore) GetSessions(userId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
- if cur := <-me.CleanUpExpiredSessions(T, userId); cur.Err != nil {
+ if cur := <-me.CleanUpExpiredSessions(userId); cur.Err != nil {
l4g.Error("Failed to cleanup sessions in getSessions err=%v", cur.Err)
}
@@ -123,7 +122,7 @@ func (me SqlSessionStore) GetSessions(T goi18n.TranslateFunc, userId string) Sto
return storeChannel
}
-func (me SqlSessionStore) Remove(T goi18n.TranslateFunc, sessionIdOrToken string) StoreChannel {
+func (me SqlSessionStore) Remove(sessionIdOrToken string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -141,7 +140,7 @@ func (me SqlSessionStore) Remove(T goi18n.TranslateFunc, sessionIdOrToken string
return storeChannel
}
-func (me SqlSessionStore) RemoveAllSessionsForTeam(T goi18n.TranslateFunc, teamId string) StoreChannel {
+func (me SqlSessionStore) RemoveAllSessionsForTeam(teamId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -159,7 +158,7 @@ func (me SqlSessionStore) RemoveAllSessionsForTeam(T goi18n.TranslateFunc, teamI
return storeChannel
}
-func (me SqlSessionStore) PermanentDeleteSessionsByUser(T goi18n.TranslateFunc, userId string) StoreChannel {
+func (me SqlSessionStore) PermanentDeleteSessionsByUser(userId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -177,7 +176,7 @@ func (me SqlSessionStore) PermanentDeleteSessionsByUser(T goi18n.TranslateFunc,
return storeChannel
}
-func (me SqlSessionStore) CleanUpExpiredSessions(T goi18n.TranslateFunc, userId string) StoreChannel {
+func (me SqlSessionStore) CleanUpExpiredSessions(userId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -196,7 +195,7 @@ func (me SqlSessionStore) CleanUpExpiredSessions(T goi18n.TranslateFunc, userId
return storeChannel
}
-func (me SqlSessionStore) UpdateLastActivityAt(T goi18n.TranslateFunc, sessionId string, time int64) StoreChannel {
+func (me SqlSessionStore) UpdateLastActivityAt(sessionId string, time int64) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -215,7 +214,7 @@ func (me SqlSessionStore) UpdateLastActivityAt(T goi18n.TranslateFunc, sessionId
return storeChannel
}
-func (me SqlSessionStore) UpdateRoles(T goi18n.TranslateFunc, userId, roles string) StoreChannel {
+func (me SqlSessionStore) UpdateRoles(userId, roles string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
diff --git a/store/sql_session_store_test.go b/store/sql_session_store_test.go
index 73ec59fb0..cec8e93b0 100644
--- a/store/sql_session_store_test.go
+++ b/store/sql_session_store_test.go
@@ -5,7 +5,6 @@ package store
import (
"github.com/mattermost/platform/model"
- "github.com/mattermost/platform/utils"
"testing"
)
@@ -16,7 +15,7 @@ func TestSessionStoreSave(t *testing.T) {
s1.UserId = model.NewId()
s1.TeamId = model.NewId()
- if err := (<-store.Session().Save(utils.T, &s1)).Err; err != nil {
+ if err := (<-store.Session().Save(&s1)).Err; err != nil {
t.Fatal(err)
}
}
@@ -27,20 +26,20 @@ func TestSessionGet(t *testing.T) {
s1 := model.Session{}
s1.UserId = model.NewId()
s1.TeamId = model.NewId()
- Must(store.Session().Save(utils.T, &s1))
+ Must(store.Session().Save(&s1))
s2 := model.Session{}
s2.UserId = s1.UserId
s2.TeamId = s1.TeamId
- Must(store.Session().Save(utils.T, &s2))
+ Must(store.Session().Save(&s2))
s3 := model.Session{}
s3.UserId = s1.UserId
s3.TeamId = s1.TeamId
s3.ExpiresAt = 1
- Must(store.Session().Save(utils.T, &s3))
+ Must(store.Session().Save(&s3))
- if rs1 := (<-store.Session().Get(utils.T, s1.Id)); rs1.Err != nil {
+ if rs1 := (<-store.Session().Get(s1.Id)); rs1.Err != nil {
t.Fatal(rs1.Err)
} else {
if rs1.Data.(*model.Session).Id != s1.Id {
@@ -48,7 +47,7 @@ func TestSessionGet(t *testing.T) {
}
}
- if rs2 := (<-store.Session().GetSessions(utils.T, s1.UserId)); rs2.Err != nil {
+ if rs2 := (<-store.Session().GetSessions(s1.UserId)); rs2.Err != nil {
t.Fatal(rs2.Err)
} else {
if len(rs2.Data.([]*model.Session)) != 2 {
@@ -64,9 +63,9 @@ func TestSessionRemove(t *testing.T) {
s1 := model.Session{}
s1.UserId = model.NewId()
s1.TeamId = model.NewId()
- Must(store.Session().Save(utils.T, &s1))
+ Must(store.Session().Save(&s1))
- if rs1 := (<-store.Session().Get(utils.T, s1.Id)); rs1.Err != nil {
+ if rs1 := (<-store.Session().Get(s1.Id)); rs1.Err != nil {
t.Fatal(rs1.Err)
} else {
if rs1.Data.(*model.Session).Id != s1.Id {
@@ -74,9 +73,9 @@ func TestSessionRemove(t *testing.T) {
}
}
- Must(store.Session().Remove(utils.T, s1.Id))
+ Must(store.Session().Remove(s1.Id))
- if rs2 := (<-store.Session().Get(utils.T, s1.Id)); rs2.Err == nil {
+ if rs2 := (<-store.Session().Get(s1.Id)); rs2.Err == nil {
t.Fatal("should have been removed")
}
}
@@ -87,9 +86,9 @@ func TestSessionRemoveAll(t *testing.T) {
s1 := model.Session{}
s1.UserId = model.NewId()
s1.TeamId = model.NewId()
- Must(store.Session().Save(utils.T, &s1))
+ Must(store.Session().Save(&s1))
- if rs1 := (<-store.Session().Get(utils.T, s1.Id)); rs1.Err != nil {
+ if rs1 := (<-store.Session().Get(s1.Id)); rs1.Err != nil {
t.Fatal(rs1.Err)
} else {
if rs1.Data.(*model.Session).Id != s1.Id {
@@ -97,9 +96,9 @@ func TestSessionRemoveAll(t *testing.T) {
}
}
- Must(store.Session().RemoveAllSessionsForTeam(utils.T, s1.TeamId))
+ Must(store.Session().RemoveAllSessionsForTeam(s1.TeamId))
- if rs2 := (<-store.Session().Get(utils.T, s1.Id)); rs2.Err == nil {
+ if rs2 := (<-store.Session().Get(s1.Id)); rs2.Err == nil {
t.Fatal("should have been removed")
}
}
@@ -110,9 +109,9 @@ func TestSessionRemoveByUser(t *testing.T) {
s1 := model.Session{}
s1.UserId = model.NewId()
s1.TeamId = model.NewId()
- Must(store.Session().Save(utils.T, &s1))
+ Must(store.Session().Save(&s1))
- if rs1 := (<-store.Session().Get(utils.T, s1.Id)); rs1.Err != nil {
+ if rs1 := (<-store.Session().Get(s1.Id)); rs1.Err != nil {
t.Fatal(rs1.Err)
} else {
if rs1.Data.(*model.Session).Id != s1.Id {
@@ -120,9 +119,9 @@ func TestSessionRemoveByUser(t *testing.T) {
}
}
- Must(store.Session().PermanentDeleteSessionsByUser(utils.T, s1.UserId))
+ Must(store.Session().PermanentDeleteSessionsByUser(s1.UserId))
- if rs2 := (<-store.Session().Get(utils.T, s1.Id)); rs2.Err == nil {
+ if rs2 := (<-store.Session().Get(s1.Id)); rs2.Err == nil {
t.Fatal("should have been removed")
}
}
@@ -133,9 +132,9 @@ func TestSessionRemoveToken(t *testing.T) {
s1 := model.Session{}
s1.UserId = model.NewId()
s1.TeamId = model.NewId()
- Must(store.Session().Save(utils.T, &s1))
+ Must(store.Session().Save(&s1))
- if rs1 := (<-store.Session().Get(utils.T, s1.Id)); rs1.Err != nil {
+ if rs1 := (<-store.Session().Get(s1.Id)); rs1.Err != nil {
t.Fatal(rs1.Err)
} else {
if rs1.Data.(*model.Session).Id != s1.Id {
@@ -143,13 +142,13 @@ func TestSessionRemoveToken(t *testing.T) {
}
}
- Must(store.Session().Remove(utils.T, s1.Token))
+ Must(store.Session().Remove(s1.Token))
- if rs2 := (<-store.Session().Get(utils.T, s1.Id)); rs2.Err == nil {
+ if rs2 := (<-store.Session().Get(s1.Id)); rs2.Err == nil {
t.Fatal("should have been removed")
}
- if rs3 := (<-store.Session().GetSessions(utils.T, s1.UserId)); rs3.Err != nil {
+ if rs3 := (<-store.Session().GetSessions(s1.UserId)); rs3.Err != nil {
t.Fatal(rs3.Err)
} else {
if len(rs3.Data.([]*model.Session)) != 0 {
@@ -164,13 +163,13 @@ func TestSessionStoreUpdateLastActivityAt(t *testing.T) {
s1 := model.Session{}
s1.UserId = model.NewId()
s1.TeamId = model.NewId()
- Must(store.Session().Save(utils.T, &s1))
+ Must(store.Session().Save(&s1))
- if err := (<-store.Session().UpdateLastActivityAt(utils.T, s1.Id, 1234567890)).Err; err != nil {
+ if err := (<-store.Session().UpdateLastActivityAt(s1.Id, 1234567890)).Err; err != nil {
t.Fatal(err)
}
- if r1 := <-store.Session().Get(utils.T, s1.Id); r1.Err != nil {
+ if r1 := <-store.Session().Get(s1.Id); r1.Err != nil {
t.Fatal(r1.Err)
} else {
if r1.Data.(*model.Session).LastActivityAt != 1234567890 {
diff --git a/store/sql_store.go b/store/sql_store.go
index 40d9c7f5a..d0471fa1e 100644
--- a/store/sql_store.go
+++ b/store/sql_store.go
@@ -15,6 +15,7 @@ import (
"encoding/json"
"errors"
"fmt"
+ l4g "github.com/alecthomas/log4go"
"io"
sqltrace "log"
"math/rand"
@@ -22,7 +23,6 @@ import (
"strings"
"time"
- l4g "github.com/alecthomas/log4go"
"github.com/go-gorp/gorp"
_ "github.com/go-sql-driver/mysql"
_ "github.com/lib/pq"
@@ -148,15 +148,15 @@ func NewSqlStore() Store {
sqlStore.webhook.(*SqlWebhookStore).CreateIndexesIfNotExists()
sqlStore.preference.(*SqlPreferenceStore).CreateIndexesIfNotExists()
- sqlStore.preference.(*SqlPreferenceStore).DeleteUnusedFeatures(utils.T)
+ sqlStore.preference.(*SqlPreferenceStore).DeleteUnusedFeatures()
if model.IsPreviousVersion(schemaVersion) || isSchemaVersion07 || isSchemaVersion10 {
- sqlStore.system.Update(utils.T, &model.System{Name: "Version", Value: model.CurrentVersion})
+ sqlStore.system.Update(&model.System{Name: "Version", Value: model.CurrentVersion})
l4g.Warn("The database schema has been upgraded to version " + model.CurrentVersion)
}
if schemaVersion == "" {
- sqlStore.system.Save(utils.T, &model.System{Name: "Version", Value: model.CurrentVersion})
+ sqlStore.system.Save(&model.System{Name: "Version", Value: model.CurrentVersion})
l4g.Info("The database schema has been set to version " + model.CurrentVersion)
}
@@ -210,12 +210,12 @@ func (ss SqlStore) GetCurrentSchemaVersion() string {
}
func (ss SqlStore) MarkSystemRanUnitTests() {
- if result := <-ss.System().Get(utils.T); result.Err == nil {
+ if result := <-ss.System().Get(); result.Err == nil {
props := result.Data.(model.StringMap)
unitTests := props[model.SYSTEM_RAN_UNIT_TESTS]
if len(unitTests) == 0 {
systemTests := &model.System{Name: model.SYSTEM_RAN_UNIT_TESTS, Value: "1"}
- <-ss.System().Save(utils.T, systemTests)
+ <-ss.System().Save(systemTests)
}
}
}
diff --git a/store/sql_system_store.go b/store/sql_system_store.go
index 184e8569f..1fbdfb333 100644
--- a/store/sql_system_store.go
+++ b/store/sql_system_store.go
@@ -5,7 +5,6 @@ package store
import (
"github.com/mattermost/platform/model"
- goi18n "github.com/nicksnyder/go-i18n/i18n"
)
type SqlSystemStore struct {
@@ -30,7 +29,7 @@ func (s SqlSystemStore) UpgradeSchemaIfNeeded() {
func (s SqlSystemStore) CreateIndexesIfNotExists() {
}
-func (s SqlSystemStore) Save(T goi18n.TranslateFunc, system *model.System) StoreChannel {
+func (s SqlSystemStore) Save(system *model.System) StoreChannel {
storeChannel := make(StoreChannel)
@@ -48,7 +47,7 @@ func (s SqlSystemStore) Save(T goi18n.TranslateFunc, system *model.System) Store
return storeChannel
}
-func (s SqlSystemStore) Update(T goi18n.TranslateFunc, system *model.System) StoreChannel {
+func (s SqlSystemStore) Update(system *model.System) StoreChannel {
storeChannel := make(StoreChannel)
@@ -66,7 +65,7 @@ func (s SqlSystemStore) Update(T goi18n.TranslateFunc, system *model.System) Sto
return storeChannel
}
-func (s SqlSystemStore) Get(T goi18n.TranslateFunc) StoreChannel {
+func (s SqlSystemStore) Get() StoreChannel {
storeChannel := make(StoreChannel)
diff --git a/store/sql_system_store_test.go b/store/sql_system_store_test.go
index 5817f9735..8ff5445cc 100644
--- a/store/sql_system_store_test.go
+++ b/store/sql_system_store_test.go
@@ -5,7 +5,6 @@ package store
import (
"github.com/mattermost/platform/model"
- "github.com/mattermost/platform/utils"
"testing"
)
@@ -13,9 +12,9 @@ func TestSqlSystemStore(t *testing.T) {
Setup()
system := &model.System{Name: model.NewId(), Value: "value"}
- Must(store.System().Save(utils.T, system))
+ Must(store.System().Save(system))
- result := <-store.System().Get(utils.T)
+ result := <-store.System().Get()
systems := result.Data.(model.StringMap)
if systems[system.Name] != system.Value {
@@ -23,9 +22,9 @@ func TestSqlSystemStore(t *testing.T) {
}
system.Value = "value2"
- Must(store.System().Update(utils.T, system))
+ Must(store.System().Update(system))
- result2 := <-store.System().Get(utils.T)
+ result2 := <-store.System().Get()
systems2 := result2.Data.(model.StringMap)
if systems2[system.Name] != system.Value {
diff --git a/store/sql_team_store.go b/store/sql_team_store.go
index 6c2eb6a21..9578549ca 100644
--- a/store/sql_team_store.go
+++ b/store/sql_team_store.go
@@ -6,7 +6,6 @@ package store
import (
"github.com/mattermost/platform/model"
"github.com/mattermost/platform/utils"
- goi18n "github.com/nicksnyder/go-i18n/i18n"
)
type SqlTeamStore struct {
@@ -38,7 +37,7 @@ func (s SqlTeamStore) CreateIndexesIfNotExists() {
s.CreateIndexIfNotExists("idx_teams_invite_id", "Teams", "InviteId")
}
-func (s SqlTeamStore) Save(T goi18n.TranslateFunc, team *model.Team) StoreChannel {
+func (s SqlTeamStore) Save(team *model.Team) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -77,7 +76,7 @@ func (s SqlTeamStore) Save(T goi18n.TranslateFunc, team *model.Team) StoreChanne
return storeChannel
}
-func (s SqlTeamStore) Update(T goi18n.TranslateFunc, team *model.Team) StoreChannel {
+func (s SqlTeamStore) Update(team *model.Team) StoreChannel {
storeChannel := make(StoreChannel)
@@ -118,7 +117,7 @@ func (s SqlTeamStore) Update(T goi18n.TranslateFunc, team *model.Team) StoreChan
return storeChannel
}
-func (s SqlTeamStore) UpdateDisplayName(T goi18n.TranslateFunc, name string, teamId string) StoreChannel {
+func (s SqlTeamStore) UpdateDisplayName(name string, teamId string) StoreChannel {
storeChannel := make(StoreChannel)
@@ -138,7 +137,7 @@ func (s SqlTeamStore) UpdateDisplayName(T goi18n.TranslateFunc, name string, tea
return storeChannel
}
-func (s SqlTeamStore) Get(T goi18n.TranslateFunc, id string) StoreChannel {
+func (s SqlTeamStore) Get(id string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -164,7 +163,7 @@ func (s SqlTeamStore) Get(T goi18n.TranslateFunc, id string) StoreChannel {
return storeChannel
}
-func (s SqlTeamStore) GetByInviteId(T goi18n.TranslateFunc, inviteId string) StoreChannel {
+func (s SqlTeamStore) GetByInviteId(inviteId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -193,7 +192,7 @@ func (s SqlTeamStore) GetByInviteId(T goi18n.TranslateFunc, inviteId string) Sto
return storeChannel
}
-func (s SqlTeamStore) GetByName(T goi18n.TranslateFunc, name string) StoreChannel {
+func (s SqlTeamStore) GetByName(name string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -218,7 +217,7 @@ func (s SqlTeamStore) GetByName(T goi18n.TranslateFunc, name string) StoreChanne
return storeChannel
}
-func (s SqlTeamStore) GetTeamsForEmail(T goi18n.TranslateFunc, email string) StoreChannel {
+func (s SqlTeamStore) GetTeamsForEmail(email string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -244,7 +243,7 @@ func (s SqlTeamStore) GetTeamsForEmail(T goi18n.TranslateFunc, email string) Sto
return storeChannel
}
-func (s SqlTeamStore) GetAll(T goi18n.TranslateFunc) StoreChannel {
+func (s SqlTeamStore) GetAll() StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -270,7 +269,7 @@ func (s SqlTeamStore) GetAll(T goi18n.TranslateFunc) StoreChannel {
return storeChannel
}
-func (s SqlTeamStore) GetAllTeamListing(T goi18n.TranslateFunc) StoreChannel {
+func (s SqlTeamStore) GetAllTeamListing() StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -302,7 +301,7 @@ func (s SqlTeamStore) GetAllTeamListing(T goi18n.TranslateFunc) StoreChannel {
return storeChannel
}
-func (s SqlTeamStore) PermanentDelete(T goi18n.TranslateFunc, teamId string) StoreChannel {
+func (s SqlTeamStore) PermanentDelete(teamId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
diff --git a/store/sql_team_store_test.go b/store/sql_team_store_test.go
index 90f4772f1..7dc31cbe2 100644
--- a/store/sql_team_store_test.go
+++ b/store/sql_team_store_test.go
@@ -5,7 +5,6 @@ package store
import (
"github.com/mattermost/platform/model"
- "github.com/mattermost/platform/utils"
"testing"
"time"
)
@@ -19,16 +18,16 @@ func TestTeamStoreSave(t *testing.T) {
o1.Email = model.NewId() + "@nowhere.com"
o1.Type = model.TEAM_OPEN
- if err := (<-store.Team().Save(utils.T, &o1)).Err; err != nil {
+ if err := (<-store.Team().Save(&o1)).Err; err != nil {
t.Fatal("couldn't save item", err)
}
- if err := (<-store.Team().Save(utils.T, &o1)).Err; err == nil {
+ if err := (<-store.Team().Save(&o1)).Err; err == nil {
t.Fatal("shouldn't be able to update from save")
}
o1.Id = ""
- if err := (<-store.Team().Save(utils.T, &o1)).Err; err == nil {
+ if err := (<-store.Team().Save(&o1)).Err; err == nil {
t.Fatal("should be unique domain")
}
}
@@ -41,23 +40,23 @@ func TestTeamStoreUpdate(t *testing.T) {
o1.Name = "a" + model.NewId() + "b"
o1.Email = model.NewId() + "@nowhere.com"
o1.Type = model.TEAM_OPEN
- if err := (<-store.Team().Save(utils.T, &o1)).Err; err != nil {
+ if err := (<-store.Team().Save(&o1)).Err; err != nil {
t.Fatal(err)
}
time.Sleep(100 * time.Millisecond)
- if err := (<-store.Team().Update(utils.T, &o1)).Err; err != nil {
+ if err := (<-store.Team().Update(&o1)).Err; err != nil {
t.Fatal(err)
}
o1.Id = "missing"
- if err := (<-store.Team().Update(utils.T, &o1)).Err; err == nil {
+ if err := (<-store.Team().Update(&o1)).Err; err == nil {
t.Fatal("Update should have failed because of missing key")
}
o1.Id = model.NewId()
- if err := (<-store.Team().Update(utils.T, &o1)).Err; err == nil {
+ if err := (<-store.Team().Update(&o1)).Err; err == nil {
t.Fatal("Update should have faile because id change")
}
}
@@ -70,15 +69,15 @@ func TestTeamStoreUpdateDisplayName(t *testing.T) {
o1.Name = "a" + model.NewId() + "b"
o1.Email = model.NewId() + "@nowhere.com"
o1.Type = model.TEAM_OPEN
- o1 = (<-store.Team().Save(utils.T, o1)).Data.(*model.Team)
+ o1 = (<-store.Team().Save(o1)).Data.(*model.Team)
newDisplayName := "NewDisplayName"
- if err := (<-store.Team().UpdateDisplayName(utils.T, newDisplayName, o1.Id)).Err; err != nil {
+ if err := (<-store.Team().UpdateDisplayName(newDisplayName, o1.Id)).Err; err != nil {
t.Fatal(err)
}
- ro1 := (<-store.Team().Get(utils.T, o1.Id)).Data.(*model.Team)
+ ro1 := (<-store.Team().Get(o1.Id)).Data.(*model.Team)
if ro1.DisplayName != newDisplayName {
t.Fatal("DisplayName not updated")
}
@@ -92,9 +91,9 @@ func TestTeamStoreGet(t *testing.T) {
o1.Name = "a" + model.NewId() + "b"
o1.Email = model.NewId() + "@nowhere.com"
o1.Type = model.TEAM_OPEN
- Must(store.Team().Save(utils.T, &o1))
+ Must(store.Team().Save(&o1))
- if r1 := <-store.Team().Get(utils.T, o1.Id); r1.Err != nil {
+ if r1 := <-store.Team().Get(o1.Id); r1.Err != nil {
t.Fatal(r1.Err)
} else {
if r1.Data.(*model.Team).ToJson() != o1.ToJson() {
@@ -102,7 +101,7 @@ func TestTeamStoreGet(t *testing.T) {
}
}
- if err := (<-store.Team().Get(utils.T, "")).Err; err == nil {
+ if err := (<-store.Team().Get("")).Err; err == nil {
t.Fatal("Missing id should have failed")
}
}
@@ -116,11 +115,11 @@ func TestTeamStoreGetByName(t *testing.T) {
o1.Email = model.NewId() + "@nowhere.com"
o1.Type = model.TEAM_OPEN
- if err := (<-store.Team().Save(utils.T, &o1)).Err; err != nil {
+ if err := (<-store.Team().Save(&o1)).Err; err != nil {
t.Fatal(err)
}
- if r1 := <-store.Team().GetByName(utils.T, o1.Name); r1.Err != nil {
+ if r1 := <-store.Team().GetByName(o1.Name); r1.Err != nil {
t.Fatal(r1.Err)
} else {
if r1.Data.(*model.Team).ToJson() != o1.ToJson() {
@@ -128,7 +127,7 @@ func TestTeamStoreGetByName(t *testing.T) {
}
}
- if err := (<-store.Team().GetByName(utils.T, "")).Err; err == nil {
+ if err := (<-store.Team().GetByName("")).Err; err == nil {
t.Fatal("Missing id should have failed")
}
}
@@ -143,7 +142,7 @@ func TestTeamStoreGetByIniviteId(t *testing.T) {
o1.Type = model.TEAM_OPEN
o1.InviteId = model.NewId()
- if err := (<-store.Team().Save(utils.T, &o1)).Err; err != nil {
+ if err := (<-store.Team().Save(&o1)).Err; err != nil {
t.Fatal(err)
}
@@ -153,11 +152,11 @@ func TestTeamStoreGetByIniviteId(t *testing.T) {
o2.Email = model.NewId() + "@nowhere.com"
o2.Type = model.TEAM_OPEN
- if err := (<-store.Team().Save(utils.T, &o2)).Err; err != nil {
+ if err := (<-store.Team().Save(&o2)).Err; err != nil {
t.Fatal(err)
}
- if r1 := <-store.Team().GetByInviteId(utils.T, o1.InviteId); r1.Err != nil {
+ if r1 := <-store.Team().GetByInviteId(o1.InviteId); r1.Err != nil {
t.Fatal(r1.Err)
} else {
if r1.Data.(*model.Team).ToJson() != o1.ToJson() {
@@ -166,9 +165,9 @@ func TestTeamStoreGetByIniviteId(t *testing.T) {
}
o2.InviteId = ""
- <-store.Team().Update(utils.T, &o2)
+ <-store.Team().Update(&o2)
- if r1 := <-store.Team().GetByInviteId(utils.T, o2.Id); r1.Err != nil {
+ if r1 := <-store.Team().GetByInviteId(o2.Id); r1.Err != nil {
t.Fatal(r1.Err)
} else {
if r1.Data.(*model.Team).Id != o2.Id {
@@ -176,7 +175,7 @@ func TestTeamStoreGetByIniviteId(t *testing.T) {
}
}
- if err := (<-store.Team().GetByInviteId(utils.T, "")).Err; err == nil {
+ if err := (<-store.Team().GetByInviteId("")).Err; err == nil {
t.Fatal("Missing id should have failed")
}
}
@@ -189,14 +188,14 @@ func TestTeamStoreGetForEmail(t *testing.T) {
o1.Name = "a" + model.NewId() + "b"
o1.Email = model.NewId() + "@nowhere.com"
o1.Type = model.TEAM_OPEN
- Must(store.Team().Save(utils.T, &o1))
+ Must(store.Team().Save(&o1))
u1 := model.User{}
u1.TeamId = o1.Id
u1.Email = model.NewId()
- Must(store.User().Save(utils.T, &u1))
+ Must(store.User().Save(&u1))
- if r1 := <-store.Team().GetTeamsForEmail(utils.T, u1.Email); r1.Err != nil {
+ if r1 := <-store.Team().GetTeamsForEmail(u1.Email); r1.Err != nil {
t.Fatal(r1.Err)
} else {
teams := r1.Data.([]*model.Team)
@@ -206,7 +205,7 @@ func TestTeamStoreGetForEmail(t *testing.T) {
}
}
- if r1 := <-store.Team().GetTeamsForEmail(utils.T, "missing"); r1.Err != nil {
+ if r1 := <-store.Team().GetTeamsForEmail("missing"); r1.Err != nil {
t.Fatal(r1.Err)
}
}
@@ -220,16 +219,16 @@ func TestAllTeamListing(t *testing.T) {
o1.Email = model.NewId() + "@nowhere.com"
o1.Type = model.TEAM_OPEN
o1.AllowTeamListing = true
- Must(store.Team().Save(utils.T, &o1))
+ Must(store.Team().Save(&o1))
o2 := model.Team{}
o2.DisplayName = "DisplayName"
o2.Name = "a" + model.NewId() + "b"
o2.Email = model.NewId() + "@nowhere.com"
o2.Type = model.TEAM_OPEN
- Must(store.Team().Save(utils.T, &o2))
+ Must(store.Team().Save(&o2))
- if r1 := <-store.Team().GetAllTeamListing(utils.T); r1.Err != nil {
+ if r1 := <-store.Team().GetAllTeamListing(); r1.Err != nil {
t.Fatal(r1.Err)
} else {
teams := r1.Data.([]*model.Team)
@@ -249,16 +248,16 @@ func TestDelete(t *testing.T) {
o1.Email = model.NewId() + "@nowhere.com"
o1.Type = model.TEAM_OPEN
o1.AllowTeamListing = true
- Must(store.Team().Save(utils.T, &o1))
+ Must(store.Team().Save(&o1))
o2 := model.Team{}
o2.DisplayName = "DisplayName"
o2.Name = "a" + model.NewId() + "b"
o2.Email = model.NewId() + "@nowhere.com"
o2.Type = model.TEAM_OPEN
- Must(store.Team().Save(utils.T, &o2))
+ Must(store.Team().Save(&o2))
- if r1 := <-store.Team().PermanentDelete(utils.T, o1.Id); r1.Err != nil {
+ if r1 := <-store.Team().PermanentDelete(o1.Id); r1.Err != nil {
t.Fatal(r1.Err)
}
}
diff --git a/store/sql_user_store.go b/store/sql_user_store.go
index e17db6666..0f73f73c3 100644
--- a/store/sql_user_store.go
+++ b/store/sql_user_store.go
@@ -5,11 +5,9 @@ package store
import (
"fmt"
- "strings"
-
"github.com/mattermost/platform/model"
"github.com/mattermost/platform/utils"
- goi18n "github.com/nicksnyder/go-i18n/i18n"
+ "strings"
)
const (
@@ -56,7 +54,7 @@ func (us SqlUserStore) CreateIndexesIfNotExists() {
us.CreateIndexIfNotExists("idx_users_email", "Users", "Email")
}
-func (us SqlUserStore) Save(T goi18n.TranslateFunc, user *model.User) StoreChannel {
+func (us SqlUserStore) Save(user *model.User) StoreChannel {
storeChannel := make(StoreChannel)
@@ -108,7 +106,7 @@ func (us SqlUserStore) Save(T goi18n.TranslateFunc, user *model.User) StoreChann
return storeChannel
}
-func (us SqlUserStore) Update(T goi18n.TranslateFunc, user *model.User, allowActiveUpdate bool) StoreChannel {
+func (us SqlUserStore) Update(user *model.User, allowActiveUpdate bool) StoreChannel {
storeChannel := make(StoreChannel)
@@ -185,7 +183,7 @@ func (us SqlUserStore) Update(T goi18n.TranslateFunc, user *model.User, allowAct
return storeChannel
}
-func (us SqlUserStore) UpdateLastPictureUpdate(T goi18n.TranslateFunc, userId string) StoreChannel {
+func (us SqlUserStore) UpdateLastPictureUpdate(userId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -206,7 +204,7 @@ func (us SqlUserStore) UpdateLastPictureUpdate(T goi18n.TranslateFunc, userId st
return storeChannel
}
-func (us SqlUserStore) UpdateLastPingAt(T goi18n.TranslateFunc, userId string, time int64) StoreChannel {
+func (us SqlUserStore) UpdateLastPingAt(userId string, time int64) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -225,7 +223,7 @@ func (us SqlUserStore) UpdateLastPingAt(T goi18n.TranslateFunc, userId string, t
return storeChannel
}
-func (us SqlUserStore) UpdateLastActivityAt(T goi18n.TranslateFunc, userId string, time int64) StoreChannel {
+func (us SqlUserStore) UpdateLastActivityAt(userId string, time int64) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -244,7 +242,7 @@ func (us SqlUserStore) UpdateLastActivityAt(T goi18n.TranslateFunc, userId strin
return storeChannel
}
-func (us SqlUserStore) UpdateUserAndSessionActivity(T goi18n.TranslateFunc, userId string, sessionId string, time int64) StoreChannel {
+func (us SqlUserStore) UpdateUserAndSessionActivity(userId string, sessionId string, time int64) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -265,7 +263,7 @@ func (us SqlUserStore) UpdateUserAndSessionActivity(T goi18n.TranslateFunc, user
return storeChannel
}
-func (us SqlUserStore) UpdatePassword(T goi18n.TranslateFunc, userId, hashedPassword string) StoreChannel {
+func (us SqlUserStore) UpdatePassword(userId, hashedPassword string) StoreChannel {
storeChannel := make(StoreChannel)
@@ -287,7 +285,7 @@ func (us SqlUserStore) UpdatePassword(T goi18n.TranslateFunc, userId, hashedPass
return storeChannel
}
-func (us SqlUserStore) UpdateFailedPasswordAttempts(T goi18n.TranslateFunc, userId string, attempts int) StoreChannel {
+func (us SqlUserStore) UpdateFailedPasswordAttempts(userId string, attempts int) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -306,7 +304,7 @@ func (us SqlUserStore) UpdateFailedPasswordAttempts(T goi18n.TranslateFunc, user
return storeChannel
}
-func (us SqlUserStore) UpdateAuthData(T goi18n.TranslateFunc, userId, service, authData string) StoreChannel {
+func (us SqlUserStore) UpdateAuthData(userId, service, authData string) StoreChannel {
storeChannel := make(StoreChannel)
@@ -328,7 +326,7 @@ func (us SqlUserStore) UpdateAuthData(T goi18n.TranslateFunc, userId, service, a
return storeChannel
}
-func (us SqlUserStore) Get(T goi18n.TranslateFunc, id string) StoreChannel {
+func (us SqlUserStore) Get(id string) StoreChannel {
storeChannel := make(StoreChannel)
@@ -351,7 +349,7 @@ func (us SqlUserStore) Get(T goi18n.TranslateFunc, id string) StoreChannel {
return storeChannel
}
-func (s SqlUserStore) GetEtagForProfiles(T goi18n.TranslateFunc, teamId string) StoreChannel {
+func (s SqlUserStore) GetEtagForProfiles(teamId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -371,7 +369,7 @@ func (s SqlUserStore) GetEtagForProfiles(T goi18n.TranslateFunc, teamId string)
return storeChannel
}
-func (us SqlUserStore) GetProfiles(T goi18n.TranslateFunc, teamId string) StoreChannel {
+func (us SqlUserStore) GetProfiles(teamId string) StoreChannel {
storeChannel := make(StoreChannel)
@@ -402,7 +400,7 @@ func (us SqlUserStore) GetProfiles(T goi18n.TranslateFunc, teamId string) StoreC
return storeChannel
}
-func (us SqlUserStore) GetSystemAdminProfiles(T goi18n.TranslateFunc) StoreChannel {
+func (us SqlUserStore) GetSystemAdminProfiles() StoreChannel {
storeChannel := make(StoreChannel)
@@ -433,7 +431,7 @@ func (us SqlUserStore) GetSystemAdminProfiles(T goi18n.TranslateFunc) StoreChann
return storeChannel
}
-func (us SqlUserStore) GetByEmail(T goi18n.TranslateFunc, teamId string, email string) StoreChannel {
+func (us SqlUserStore) GetByEmail(teamId string, email string) StoreChannel {
storeChannel := make(StoreChannel)
@@ -455,7 +453,7 @@ func (us SqlUserStore) GetByEmail(T goi18n.TranslateFunc, teamId string, email s
return storeChannel
}
-func (us SqlUserStore) GetByAuth(T goi18n.TranslateFunc, teamId string, authData string, authService string) StoreChannel {
+func (us SqlUserStore) GetByAuth(teamId string, authData string, authService string) StoreChannel {
storeChannel := make(StoreChannel)
@@ -477,7 +475,7 @@ func (us SqlUserStore) GetByAuth(T goi18n.TranslateFunc, teamId string, authData
return storeChannel
}
-func (us SqlUserStore) GetByUsername(T goi18n.TranslateFunc, teamId string, username string) StoreChannel {
+func (us SqlUserStore) GetByUsername(teamId string, username string) StoreChannel {
storeChannel := make(StoreChannel)
@@ -499,7 +497,7 @@ func (us SqlUserStore) GetByUsername(T goi18n.TranslateFunc, teamId string, user
return storeChannel
}
-func (us SqlUserStore) VerifyEmail(T goi18n.TranslateFunc, userId string) StoreChannel {
+func (us SqlUserStore) VerifyEmail(userId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -518,7 +516,7 @@ func (us SqlUserStore) VerifyEmail(T goi18n.TranslateFunc, userId string) StoreC
return storeChannel
}
-func (us SqlUserStore) GetForExport(T goi18n.TranslateFunc, teamId string) StoreChannel {
+func (us SqlUserStore) GetForExport(teamId string) StoreChannel {
storeChannel := make(StoreChannel)
@@ -545,7 +543,7 @@ func (us SqlUserStore) GetForExport(T goi18n.TranslateFunc, teamId string) Store
return storeChannel
}
-func (us SqlUserStore) GetTotalUsersCount(T goi18n.TranslateFunc) StoreChannel {
+func (us SqlUserStore) GetTotalUsersCount() StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -564,7 +562,7 @@ func (us SqlUserStore) GetTotalUsersCount(T goi18n.TranslateFunc) StoreChannel {
return storeChannel
}
-func (us SqlUserStore) GetTotalActiveUsersCount(T goi18n.TranslateFunc) StoreChannel {
+func (us SqlUserStore) GetTotalActiveUsersCount() StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -585,7 +583,7 @@ func (us SqlUserStore) GetTotalActiveUsersCount(T goi18n.TranslateFunc) StoreCha
return storeChannel
}
-func (us SqlUserStore) PermanentDelete(T goi18n.TranslateFunc, userId string) StoreChannel {
+func (us SqlUserStore) PermanentDelete(userId string) StoreChannel {
storeChannel := make(StoreChannel)
diff --git a/store/sql_user_store_test.go b/store/sql_user_store_test.go
index 50296b251..d1ee5e647 100644
--- a/store/sql_user_store_test.go
+++ b/store/sql_user_store_test.go
@@ -5,7 +5,6 @@ package store
import (
"github.com/mattermost/platform/model"
- "github.com/mattermost/platform/utils"
"strings"
"testing"
"time"
@@ -19,27 +18,27 @@ func TestUserStoreSave(t *testing.T) {
u1.Username = model.NewId()
u1.TeamId = model.NewId()
- if err := (<-store.User().Save(utils.T, &u1)).Err; err != nil {
+ if err := (<-store.User().Save(&u1)).Err; err != nil {
t.Fatal("couldn't save user", err)
}
- if err := (<-store.User().Save(utils.T, &u1)).Err; err == nil {
+ if err := (<-store.User().Save(&u1)).Err; err == nil {
t.Fatal("shouldn't be able to update user from save")
}
u1.Id = ""
- if err := (<-store.User().Save(utils.T, &u1)).Err; err == nil {
+ if err := (<-store.User().Save(&u1)).Err; err == nil {
t.Fatal("should be unique email")
}
u1.Email = ""
- if err := (<-store.User().Save(utils.T, &u1)).Err; err == nil {
+ if err := (<-store.User().Save(&u1)).Err; err == nil {
t.Fatal("should be unique username")
}
u1.Email = strings.Repeat("0123456789", 20)
u1.Username = ""
- if err := (<-store.User().Save(utils.T, &u1)).Err; err == nil {
+ if err := (<-store.User().Save(&u1)).Err; err == nil {
t.Fatal("should be unique username")
}
@@ -47,7 +46,7 @@ func TestUserStoreSave(t *testing.T) {
u1.Id = ""
u1.Email = model.NewId()
u1.Username = model.NewId()
- if err := (<-store.User().Save(utils.T, &u1)).Err; err != nil {
+ if err := (<-store.User().Save(&u1)).Err; err != nil {
t.Fatal("couldn't save item", err)
}
}
@@ -55,7 +54,7 @@ func TestUserStoreSave(t *testing.T) {
u1.Id = ""
u1.Email = model.NewId()
u1.Username = model.NewId()
- if err := (<-store.User().Save(utils.T, &u1)).Err; err == nil {
+ if err := (<-store.User().Save(&u1)).Err; err == nil {
t.Fatal("should be the limit", err)
}
}
@@ -66,21 +65,21 @@ func TestUserStoreUpdate(t *testing.T) {
u1 := model.User{}
u1.TeamId = model.NewId()
u1.Email = model.NewId()
- Must(store.User().Save(utils.T, &u1))
+ Must(store.User().Save(&u1))
time.Sleep(100 * time.Millisecond)
- if err := (<-store.User().Update(utils.T, &u1, false)).Err; err != nil {
+ if err := (<-store.User().Update(&u1, false)).Err; err != nil {
t.Fatal(err)
}
u1.Id = "missing"
- if err := (<-store.User().Update(utils.T, &u1, false)).Err; err == nil {
+ if err := (<-store.User().Update(&u1, false)).Err; err == nil {
t.Fatal("Update should have failed because of missing key")
}
u1.Id = model.NewId()
- if err := (<-store.User().Update(utils.T, &u1, false)).Err; err == nil {
+ if err := (<-store.User().Update(&u1, false)).Err; err == nil {
t.Fatal("Update should have faile because id change")
}
}
@@ -91,13 +90,13 @@ func TestUserStoreUpdateLastPingAt(t *testing.T) {
u1 := model.User{}
u1.TeamId = model.NewId()
u1.Email = model.NewId()
- Must(store.User().Save(utils.T, &u1))
+ Must(store.User().Save(&u1))
- if err := (<-store.User().UpdateLastPingAt(utils.T, u1.Id, 1234567890)).Err; err != nil {
+ if err := (<-store.User().UpdateLastPingAt(u1.Id, 1234567890)).Err; err != nil {
t.Fatal(err)
}
- if r1 := <-store.User().Get(utils.T, u1.Id); r1.Err != nil {
+ if r1 := <-store.User().Get(u1.Id); r1.Err != nil {
t.Fatal(r1.Err)
} else {
if r1.Data.(*model.User).LastPingAt != 1234567890 {
@@ -113,13 +112,13 @@ func TestUserStoreUpdateLastActivityAt(t *testing.T) {
u1 := model.User{}
u1.TeamId = model.NewId()
u1.Email = model.NewId()
- Must(store.User().Save(utils.T, &u1))
+ Must(store.User().Save(&u1))
- if err := (<-store.User().UpdateLastActivityAt(utils.T, u1.Id, 1234567890)).Err; err != nil {
+ if err := (<-store.User().UpdateLastActivityAt(u1.Id, 1234567890)).Err; err != nil {
t.Fatal(err)
}
- if r1 := <-store.User().Get(utils.T, u1.Id); r1.Err != nil {
+ if r1 := <-store.User().Get(u1.Id); r1.Err != nil {
t.Fatal(r1.Err)
} else {
if r1.Data.(*model.User).LastActivityAt != 1234567890 {
@@ -135,13 +134,13 @@ func TestUserStoreUpdateFailedPasswordAttempts(t *testing.T) {
u1 := model.User{}
u1.TeamId = model.NewId()
u1.Email = model.NewId()
- Must(store.User().Save(utils.T, &u1))
+ Must(store.User().Save(&u1))
- if err := (<-store.User().UpdateFailedPasswordAttempts(utils.T, u1.Id, 3)).Err; err != nil {
+ if err := (<-store.User().UpdateFailedPasswordAttempts(u1.Id, 3)).Err; err != nil {
t.Fatal(err)
}
- if r1 := <-store.User().Get(utils.T, u1.Id); r1.Err != nil {
+ if r1 := <-store.User().Get(u1.Id); r1.Err != nil {
t.Fatal(r1.Err)
} else {
if r1.Data.(*model.User).FailedAttempts != 3 {
@@ -157,18 +156,18 @@ func TestUserStoreUpdateUserAndSessionActivity(t *testing.T) {
u1 := model.User{}
u1.TeamId = model.NewId()
u1.Email = model.NewId()
- Must(store.User().Save(utils.T, &u1))
+ Must(store.User().Save(&u1))
s1 := model.Session{}
s1.UserId = u1.Id
s1.TeamId = u1.TeamId
- Must(store.Session().Save(utils.T, &s1))
+ Must(store.Session().Save(&s1))
- if err := (<-store.User().UpdateUserAndSessionActivity(utils.T, u1.Id, s1.Id, 1234567890)).Err; err != nil {
+ if err := (<-store.User().UpdateUserAndSessionActivity(u1.Id, s1.Id, 1234567890)).Err; err != nil {
t.Fatal(err)
}
- if r1 := <-store.User().Get(utils.T, u1.Id); r1.Err != nil {
+ if r1 := <-store.User().Get(u1.Id); r1.Err != nil {
t.Fatal(r1.Err)
} else {
if r1.Data.(*model.User).LastActivityAt != 1234567890 {
@@ -176,7 +175,7 @@ func TestUserStoreUpdateUserAndSessionActivity(t *testing.T) {
}
}
- if r2 := <-store.Session().Get(utils.T, s1.Id); r2.Err != nil {
+ if r2 := <-store.Session().Get(s1.Id); r2.Err != nil {
t.Fatal(r2.Err)
} else {
if r2.Data.(*model.Session).LastActivityAt != 1234567890 {
@@ -192,9 +191,9 @@ func TestUserStoreGet(t *testing.T) {
u1 := model.User{}
u1.TeamId = model.NewId()
u1.Email = model.NewId()
- Must(store.User().Save(utils.T, &u1))
+ Must(store.User().Save(&u1))
- if r1 := <-store.User().Get(utils.T, u1.Id); r1.Err != nil {
+ if r1 := <-store.User().Get(u1.Id); r1.Err != nil {
t.Fatal(r1.Err)
} else {
if r1.Data.(*model.User).ToJson() != u1.ToJson() {
@@ -202,7 +201,7 @@ func TestUserStoreGet(t *testing.T) {
}
}
- if err := (<-store.User().Get(utils.T, "")).Err; err == nil {
+ if err := (<-store.User().Get("")).Err; err == nil {
t.Fatal("Missing id should have failed")
}
}
@@ -213,9 +212,9 @@ func TestUserCount(t *testing.T) {
u1 := model.User{}
u1.TeamId = model.NewId()
u1.Email = model.NewId()
- Must(store.User().Save(utils.T, &u1))
+ Must(store.User().Save(&u1))
- if result := <-store.User().GetTotalUsersCount(utils.T); result.Err != nil {
+ if result := <-store.User().GetTotalUsersCount(); result.Err != nil {
t.Fatal(result.Err)
} else {
count := result.Data.(int64)
@@ -231,9 +230,9 @@ func TestActiveUserCount(t *testing.T) {
u1 := model.User{}
u1.TeamId = model.NewId()
u1.Email = model.NewId()
- Must(store.User().Save(utils.T, &u1))
+ Must(store.User().Save(&u1))
- if result := <-store.User().GetTotalActiveUsersCount(utils.T); result.Err != nil {
+ if result := <-store.User().GetTotalActiveUsersCount(); result.Err != nil {
t.Fatal(result.Err)
} else {
count := result.Data.(int64)
@@ -249,14 +248,14 @@ func TestUserStoreGetProfiles(t *testing.T) {
u1 := model.User{}
u1.TeamId = model.NewId()
u1.Email = model.NewId()
- Must(store.User().Save(utils.T, &u1))
+ Must(store.User().Save(&u1))
u2 := model.User{}
u2.TeamId = u1.TeamId
u2.Email = model.NewId()
- Must(store.User().Save(utils.T, &u2))
+ Must(store.User().Save(&u2))
- if r1 := <-store.User().GetProfiles(utils.T, u1.TeamId); r1.Err != nil {
+ if r1 := <-store.User().GetProfiles(u1.TeamId); r1.Err != nil {
t.Fatal(r1.Err)
} else {
users := r1.Data.(map[string]*model.User)
@@ -269,7 +268,7 @@ func TestUserStoreGetProfiles(t *testing.T) {
}
}
- if r2 := <-store.User().GetProfiles(utils.T, "123"); r2.Err != nil {
+ if r2 := <-store.User().GetProfiles("123"); r2.Err != nil {
t.Fatal(r2.Err)
} else {
if len(r2.Data.(map[string]*model.User)) != 0 {
@@ -284,14 +283,14 @@ func TestUserStoreGetSystemAdminProfiles(t *testing.T) {
u1 := model.User{}
u1.TeamId = model.NewId()
u1.Email = model.NewId()
- Must(store.User().Save(utils.T, &u1))
+ Must(store.User().Save(&u1))
u2 := model.User{}
u2.TeamId = u1.TeamId
u2.Email = model.NewId()
- Must(store.User().Save(utils.T, &u2))
+ Must(store.User().Save(&u2))
- if r1 := <-store.User().GetSystemAdminProfiles(utils.T); r1.Err != nil {
+ if r1 := <-store.User().GetSystemAdminProfiles(); r1.Err != nil {
t.Fatal(r1.Err)
} else {
users := r1.Data.(map[string]*model.User)
@@ -307,13 +306,13 @@ func TestUserStoreGetByEmail(t *testing.T) {
u1 := model.User{}
u1.TeamId = model.NewId()
u1.Email = model.NewId()
- Must(store.User().Save(utils.T, &u1))
+ Must(store.User().Save(&u1))
- if err := (<-store.User().GetByEmail(utils.T, u1.TeamId, u1.Email)).Err; err != nil {
+ if err := (<-store.User().GetByEmail(u1.TeamId, u1.Email)).Err; err != nil {
t.Fatal(err)
}
- if err := (<-store.User().GetByEmail(utils.T, "", "")).Err; err == nil {
+ if err := (<-store.User().GetByEmail("", "")).Err; err == nil {
t.Fatal("Should have failed because of missing email")
}
}
@@ -326,13 +325,13 @@ func TestUserStoreGetByAuthData(t *testing.T) {
u1.Email = model.NewId()
u1.AuthData = "123"
u1.AuthService = "service"
- Must(store.User().Save(utils.T, &u1))
+ Must(store.User().Save(&u1))
- if err := (<-store.User().GetByAuth(utils.T, u1.TeamId, u1.AuthData, u1.AuthService)).Err; err != nil {
+ if err := (<-store.User().GetByAuth(u1.TeamId, u1.AuthData, u1.AuthService)).Err; err != nil {
t.Fatal(err)
}
- if err := (<-store.User().GetByAuth(utils.T, "", "", "")).Err; err == nil {
+ if err := (<-store.User().GetByAuth("", "", "")).Err; err == nil {
t.Fatal("Should have failed because of missing auth data")
}
}
@@ -344,13 +343,13 @@ func TestUserStoreGetByUsername(t *testing.T) {
u1.TeamId = model.NewId()
u1.Email = model.NewId()
u1.Username = model.NewId()
- Must(store.User().Save(utils.T, &u1))
+ Must(store.User().Save(&u1))
- if err := (<-store.User().GetByUsername(utils.T, u1.TeamId, u1.Username)).Err; err != nil {
+ if err := (<-store.User().GetByUsername(u1.TeamId, u1.Username)).Err; err != nil {
t.Fatal(err)
}
- if err := (<-store.User().GetByUsername(utils.T, "", "")).Err; err == nil {
+ if err := (<-store.User().GetByUsername("", "")).Err; err == nil {
t.Fatal("Should have failed because of missing username")
}
}
@@ -361,15 +360,15 @@ func TestUserStoreUpdatePassword(t *testing.T) {
u1 := model.User{}
u1.TeamId = model.NewId()
u1.Email = model.NewId()
- Must(store.User().Save(utils.T, &u1))
+ Must(store.User().Save(&u1))
hashedPassword := model.HashPassword("newpwd")
- if err := (<-store.User().UpdatePassword(utils.T, u1.Id, hashedPassword)).Err; err != nil {
+ if err := (<-store.User().UpdatePassword(u1.Id, hashedPassword)).Err; err != nil {
t.Fatal(err)
}
- if r1 := <-store.User().GetByEmail(utils.T, u1.TeamId, u1.Email); r1.Err != nil {
+ if r1 := <-store.User().GetByEmail(u1.TeamId, u1.Email); r1.Err != nil {
t.Fatal(r1.Err)
} else {
user := r1.Data.(*model.User)
@@ -385,9 +384,9 @@ func TestUserStoreDelete(t *testing.T) {
u1 := model.User{}
u1.TeamId = model.NewId()
u1.Email = model.NewId()
- Must(store.User().Save(utils.T, &u1))
+ Must(store.User().Save(&u1))
- if err := (<-store.User().PermanentDelete(utils.T, u1.Id)).Err; err != nil {
+ if err := (<-store.User().PermanentDelete(u1.Id)).Err; err != nil {
t.Fatal(err)
}
}
@@ -398,16 +397,16 @@ func TestUserStoreUpdateAuthData(t *testing.T) {
u1 := model.User{}
u1.TeamId = model.NewId()
u1.Email = model.NewId()
- Must(store.User().Save(utils.T, &u1))
+ Must(store.User().Save(&u1))
service := "someservice"
authData := "1"
- if err := (<-store.User().UpdateAuthData(utils.T, u1.Id, service, authData)).Err; err != nil {
+ if err := (<-store.User().UpdateAuthData(u1.Id, service, authData)).Err; err != nil {
t.Fatal(err)
}
- if r1 := <-store.User().GetByEmail(utils.T, u1.TeamId, u1.Email); r1.Err != nil {
+ if r1 := <-store.User().GetByEmail(u1.TeamId, u1.Email); r1.Err != nil {
t.Fatal(r1.Err)
} else {
user := r1.Data.(*model.User)
diff --git a/store/sql_webhook_store.go b/store/sql_webhook_store.go
index 8b1e8136b..b7bf0615f 100644
--- a/store/sql_webhook_store.go
+++ b/store/sql_webhook_store.go
@@ -5,7 +5,6 @@ package store
import (
"github.com/mattermost/platform/model"
- goi18n "github.com/nicksnyder/go-i18n/i18n"
)
type SqlWebhookStore struct {
@@ -44,7 +43,7 @@ func (s SqlWebhookStore) CreateIndexesIfNotExists() {
s.CreateIndexIfNotExists("idx_outgoing_webhook_team_id", "OutgoingWebhooks", "TeamId")
}
-func (s SqlWebhookStore) SaveIncoming(T goi18n.TranslateFunc, webhook *model.IncomingWebhook) StoreChannel {
+func (s SqlWebhookStore) SaveIncoming(webhook *model.IncomingWebhook) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -78,7 +77,7 @@ func (s SqlWebhookStore) SaveIncoming(T goi18n.TranslateFunc, webhook *model.Inc
return storeChannel
}
-func (s SqlWebhookStore) GetIncoming(T goi18n.TranslateFunc, id string) StoreChannel {
+func (s SqlWebhookStore) GetIncoming(id string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -99,7 +98,7 @@ func (s SqlWebhookStore) GetIncoming(T goi18n.TranslateFunc, id string) StoreCha
return storeChannel
}
-func (s SqlWebhookStore) DeleteIncoming(T goi18n.TranslateFunc, webhookId string, time int64) StoreChannel {
+func (s SqlWebhookStore) DeleteIncoming(webhookId string, time int64) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -117,7 +116,7 @@ func (s SqlWebhookStore) DeleteIncoming(T goi18n.TranslateFunc, webhookId string
return storeChannel
}
-func (s SqlWebhookStore) PermanentDeleteIncomingByUser(T goi18n.TranslateFunc, userId string) StoreChannel {
+func (s SqlWebhookStore) PermanentDeleteIncomingByUser(userId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -135,7 +134,7 @@ func (s SqlWebhookStore) PermanentDeleteIncomingByUser(T goi18n.TranslateFunc, u
return storeChannel
}
-func (s SqlWebhookStore) GetIncomingByUser(T goi18n.TranslateFunc, userId string) StoreChannel {
+func (s SqlWebhookStore) GetIncomingByUser(userId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -156,7 +155,7 @@ func (s SqlWebhookStore) GetIncomingByUser(T goi18n.TranslateFunc, userId string
return storeChannel
}
-func (s SqlWebhookStore) GetIncomingByChannel(T goi18n.TranslateFunc, channelId string) StoreChannel {
+func (s SqlWebhookStore) GetIncomingByChannel(channelId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -177,7 +176,7 @@ func (s SqlWebhookStore) GetIncomingByChannel(T goi18n.TranslateFunc, channelId
return storeChannel
}
-func (s SqlWebhookStore) SaveOutgoing(T goi18n.TranslateFunc, webhook *model.OutgoingWebhook) StoreChannel {
+func (s SqlWebhookStore) SaveOutgoing(webhook *model.OutgoingWebhook) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -211,7 +210,7 @@ func (s SqlWebhookStore) SaveOutgoing(T goi18n.TranslateFunc, webhook *model.Out
return storeChannel
}
-func (s SqlWebhookStore) GetOutgoing(T goi18n.TranslateFunc, id string) StoreChannel {
+func (s SqlWebhookStore) GetOutgoing(id string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -232,7 +231,7 @@ func (s SqlWebhookStore) GetOutgoing(T goi18n.TranslateFunc, id string) StoreCha
return storeChannel
}
-func (s SqlWebhookStore) GetOutgoingByCreator(T goi18n.TranslateFunc, userId string) StoreChannel {
+func (s SqlWebhookStore) GetOutgoingByCreator(userId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -253,7 +252,7 @@ func (s SqlWebhookStore) GetOutgoingByCreator(T goi18n.TranslateFunc, userId str
return storeChannel
}
-func (s SqlWebhookStore) GetOutgoingByChannel(T goi18n.TranslateFunc, channelId string) StoreChannel {
+func (s SqlWebhookStore) GetOutgoingByChannel(channelId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -274,7 +273,7 @@ func (s SqlWebhookStore) GetOutgoingByChannel(T goi18n.TranslateFunc, channelId
return storeChannel
}
-func (s SqlWebhookStore) GetOutgoingByTeam(T goi18n.TranslateFunc, teamId string) StoreChannel {
+func (s SqlWebhookStore) GetOutgoingByTeam(teamId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -295,7 +294,7 @@ func (s SqlWebhookStore) GetOutgoingByTeam(T goi18n.TranslateFunc, teamId string
return storeChannel
}
-func (s SqlWebhookStore) DeleteOutgoing(T goi18n.TranslateFunc, webhookId string, time int64) StoreChannel {
+func (s SqlWebhookStore) DeleteOutgoing(webhookId string, time int64) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -313,7 +312,7 @@ func (s SqlWebhookStore) DeleteOutgoing(T goi18n.TranslateFunc, webhookId string
return storeChannel
}
-func (s SqlWebhookStore) PermanentDeleteOutgoingByUser(T goi18n.TranslateFunc, userId string) StoreChannel {
+func (s SqlWebhookStore) PermanentDeleteOutgoingByUser(userId string) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
@@ -331,7 +330,7 @@ func (s SqlWebhookStore) PermanentDeleteOutgoingByUser(T goi18n.TranslateFunc, u
return storeChannel
}
-func (s SqlWebhookStore) UpdateOutgoing(T goi18n.TranslateFunc, hook *model.OutgoingWebhook) StoreChannel {
+func (s SqlWebhookStore) UpdateOutgoing(hook *model.OutgoingWebhook) StoreChannel {
storeChannel := make(StoreChannel)
go func() {
diff --git a/store/sql_webhook_store_test.go b/store/sql_webhook_store_test.go
index c5bd95af7..1a9d5be3b 100644
--- a/store/sql_webhook_store_test.go
+++ b/store/sql_webhook_store_test.go
@@ -5,7 +5,6 @@ package store
import (
"github.com/mattermost/platform/model"
- "github.com/mattermost/platform/utils"
"testing"
)
@@ -17,11 +16,11 @@ func TestWebhookStoreSaveIncoming(t *testing.T) {
o1.UserId = model.NewId()
o1.TeamId = model.NewId()
- if err := (<-store.Webhook().SaveIncoming(utils.T, &o1)).Err; err != nil {
+ if err := (<-store.Webhook().SaveIncoming(&o1)).Err; err != nil {
t.Fatal("couldn't save item", err)
}
- if err := (<-store.Webhook().SaveIncoming(utils.T, &o1)).Err; err == nil {
+ if err := (<-store.Webhook().SaveIncoming(&o1)).Err; err == nil {
t.Fatal("shouldn't be able to update from save")
}
}
@@ -34,9 +33,9 @@ func TestWebhookStoreGetIncoming(t *testing.T) {
o1.UserId = model.NewId()
o1.TeamId = model.NewId()
- o1 = (<-store.Webhook().SaveIncoming(utils.T, o1)).Data.(*model.IncomingWebhook)
+ o1 = (<-store.Webhook().SaveIncoming(o1)).Data.(*model.IncomingWebhook)
- if r1 := <-store.Webhook().GetIncoming(utils.T, o1.Id); r1.Err != nil {
+ if r1 := <-store.Webhook().GetIncoming(o1.Id); r1.Err != nil {
t.Fatal(r1.Err)
} else {
if r1.Data.(*model.IncomingWebhook).CreateAt != o1.CreateAt {
@@ -44,7 +43,7 @@ func TestWebhookStoreGetIncoming(t *testing.T) {
}
}
- if err := (<-store.Webhook().GetIncoming(utils.T, "123")).Err; err == nil {
+ if err := (<-store.Webhook().GetIncoming("123")).Err; err == nil {
t.Fatal("Missing id should have failed")
}
}
@@ -57,9 +56,9 @@ func TestWebhookStoreGetIncomingByUser(t *testing.T) {
o1.UserId = model.NewId()
o1.TeamId = model.NewId()
- o1 = (<-store.Webhook().SaveIncoming(utils.T, o1)).Data.(*model.IncomingWebhook)
+ o1 = (<-store.Webhook().SaveIncoming(o1)).Data.(*model.IncomingWebhook)
- if r1 := <-store.Webhook().GetIncomingByUser(utils.T, o1.UserId); r1.Err != nil {
+ if r1 := <-store.Webhook().GetIncomingByUser(o1.UserId); r1.Err != nil {
t.Fatal(r1.Err)
} else {
if r1.Data.([]*model.IncomingWebhook)[0].CreateAt != o1.CreateAt {
@@ -67,7 +66,7 @@ func TestWebhookStoreGetIncomingByUser(t *testing.T) {
}
}
- if result := <-store.Webhook().GetIncomingByUser(utils.T, "123"); result.Err != nil {
+ if result := <-store.Webhook().GetIncomingByUser("123"); result.Err != nil {
t.Fatal(result.Err)
} else {
if len(result.Data.([]*model.IncomingWebhook)) != 0 {
@@ -84,9 +83,9 @@ func TestWebhookStoreDeleteIncoming(t *testing.T) {
o1.UserId = model.NewId()
o1.TeamId = model.NewId()
- o1 = (<-store.Webhook().SaveIncoming(utils.T, o1)).Data.(*model.IncomingWebhook)
+ o1 = (<-store.Webhook().SaveIncoming(o1)).Data.(*model.IncomingWebhook)
- if r1 := <-store.Webhook().GetIncoming(utils.T, o1.Id); r1.Err != nil {
+ if r1 := <-store.Webhook().GetIncoming(o1.Id); r1.Err != nil {
t.Fatal(r1.Err)
} else {
if r1.Data.(*model.IncomingWebhook).CreateAt != o1.CreateAt {
@@ -94,11 +93,11 @@ func TestWebhookStoreDeleteIncoming(t *testing.T) {
}
}
- if r2 := <-store.Webhook().DeleteIncoming(utils.T, o1.Id, model.GetMillis()); r2.Err != nil {
+ if r2 := <-store.Webhook().DeleteIncoming(o1.Id, model.GetMillis()); r2.Err != nil {
t.Fatal(r2.Err)
}
- if r3 := (<-store.Webhook().GetIncoming(utils.T, o1.Id)); r3.Err == nil {
+ if r3 := (<-store.Webhook().GetIncoming(o1.Id)); r3.Err == nil {
t.Log(r3.Data)
t.Fatal("Missing id should have failed")
}
@@ -112,9 +111,9 @@ func TestWebhookStoreDeleteIncomingByUser(t *testing.T) {
o1.UserId = model.NewId()
o1.TeamId = model.NewId()
- o1 = (<-store.Webhook().SaveIncoming(utils.T, o1)).Data.(*model.IncomingWebhook)
+ o1 = (<-store.Webhook().SaveIncoming(o1)).Data.(*model.IncomingWebhook)
- if r1 := <-store.Webhook().GetIncoming(utils.T, o1.Id); r1.Err != nil {
+ if r1 := <-store.Webhook().GetIncoming(o1.Id); r1.Err != nil {
t.Fatal(r1.Err)
} else {
if r1.Data.(*model.IncomingWebhook).CreateAt != o1.CreateAt {
@@ -122,11 +121,11 @@ func TestWebhookStoreDeleteIncomingByUser(t *testing.T) {
}
}
- if r2 := <-store.Webhook().PermanentDeleteIncomingByUser(utils.T, o1.UserId); r2.Err != nil {
+ if r2 := <-store.Webhook().PermanentDeleteIncomingByUser(o1.UserId); r2.Err != nil {
t.Fatal(r2.Err)
}
- if r3 := (<-store.Webhook().GetIncoming(utils.T, o1.Id)); r3.Err == nil {
+ if r3 := (<-store.Webhook().GetIncoming(o1.Id)); r3.Err == nil {
t.Log(r3.Data)
t.Fatal("Missing id should have failed")
}
@@ -141,11 +140,11 @@ func TestWebhookStoreSaveOutgoing(t *testing.T) {
o1.TeamId = model.NewId()
o1.CallbackURLs = []string{"http://nowhere.com/"}
- if err := (<-store.Webhook().SaveOutgoing(utils.T, &o1)).Err; err != nil {
+ if err := (<-store.Webhook().SaveOutgoing(&o1)).Err; err != nil {
t.Fatal("couldn't save item", err)
}
- if err := (<-store.Webhook().SaveOutgoing(utils.T, &o1)).Err; err == nil {
+ if err := (<-store.Webhook().SaveOutgoing(&o1)).Err; err == nil {
t.Fatal("shouldn't be able to update from save")
}
}
@@ -159,9 +158,9 @@ func TestWebhookStoreGetOutgoing(t *testing.T) {
o1.TeamId = model.NewId()
o1.CallbackURLs = []string{"http://nowhere.com/"}
- o1 = (<-store.Webhook().SaveOutgoing(utils.T, o1)).Data.(*model.OutgoingWebhook)
+ o1 = (<-store.Webhook().SaveOutgoing(o1)).Data.(*model.OutgoingWebhook)
- if r1 := <-store.Webhook().GetOutgoing(utils.T, o1.Id); r1.Err != nil {
+ if r1 := <-store.Webhook().GetOutgoing(o1.Id); r1.Err != nil {
t.Fatal(r1.Err)
} else {
if r1.Data.(*model.OutgoingWebhook).CreateAt != o1.CreateAt {
@@ -169,7 +168,7 @@ func TestWebhookStoreGetOutgoing(t *testing.T) {
}
}
- if err := (<-store.Webhook().GetOutgoing(utils.T, "123")).Err; err == nil {
+ if err := (<-store.Webhook().GetOutgoing("123")).Err; err == nil {
t.Fatal("Missing id should have failed")
}
}
@@ -183,9 +182,9 @@ func TestWebhookStoreGetOutgoingByChannel(t *testing.T) {
o1.TeamId = model.NewId()
o1.CallbackURLs = []string{"http://nowhere.com/"}
- o1 = (<-store.Webhook().SaveOutgoing(utils.T, o1)).Data.(*model.OutgoingWebhook)
+ o1 = (<-store.Webhook().SaveOutgoing(o1)).Data.(*model.OutgoingWebhook)
- if r1 := <-store.Webhook().GetOutgoingByChannel(utils.T, o1.ChannelId); r1.Err != nil {
+ if r1 := <-store.Webhook().GetOutgoingByChannel(o1.ChannelId); r1.Err != nil {
t.Fatal(r1.Err)
} else {
if r1.Data.([]*model.OutgoingWebhook)[0].CreateAt != o1.CreateAt {
@@ -193,7 +192,7 @@ func TestWebhookStoreGetOutgoingByChannel(t *testing.T) {
}
}
- if result := <-store.Webhook().GetOutgoingByChannel(utils.T, "123"); result.Err != nil {
+ if result := <-store.Webhook().GetOutgoingByChannel("123"); result.Err != nil {
t.Fatal(result.Err)
} else {
if len(result.Data.([]*model.OutgoingWebhook)) != 0 {
@@ -211,9 +210,9 @@ func TestWebhookStoreGetOutgoingByCreator(t *testing.T) {
o1.TeamId = model.NewId()
o1.CallbackURLs = []string{"http://nowhere.com/"}
- o1 = (<-store.Webhook().SaveOutgoing(utils.T, o1)).Data.(*model.OutgoingWebhook)
+ o1 = (<-store.Webhook().SaveOutgoing(o1)).Data.(*model.OutgoingWebhook)
- if r1 := <-store.Webhook().GetOutgoingByCreator(utils.T, o1.CreatorId); r1.Err != nil {
+ if r1 := <-store.Webhook().GetOutgoingByCreator(o1.CreatorId); r1.Err != nil {
t.Fatal(r1.Err)
} else {
if r1.Data.([]*model.OutgoingWebhook)[0].CreateAt != o1.CreateAt {
@@ -221,7 +220,7 @@ func TestWebhookStoreGetOutgoingByCreator(t *testing.T) {
}
}
- if result := <-store.Webhook().GetOutgoingByCreator(utils.T, "123"); result.Err != nil {
+ if result := <-store.Webhook().GetOutgoingByCreator("123"); result.Err != nil {
t.Fatal(result.Err)
} else {
if len(result.Data.([]*model.OutgoingWebhook)) != 0 {
@@ -239,9 +238,9 @@ func TestWebhookStoreGetOutgoingByTeam(t *testing.T) {
o1.TeamId = model.NewId()
o1.CallbackURLs = []string{"http://nowhere.com/"}
- o1 = (<-store.Webhook().SaveOutgoing(utils.T, o1)).Data.(*model.OutgoingWebhook)
+ o1 = (<-store.Webhook().SaveOutgoing(o1)).Data.(*model.OutgoingWebhook)
- if r1 := <-store.Webhook().GetOutgoingByTeam(utils.T, o1.TeamId); r1.Err != nil {
+ if r1 := <-store.Webhook().GetOutgoingByTeam(o1.TeamId); r1.Err != nil {
t.Fatal(r1.Err)
} else {
if r1.Data.([]*model.OutgoingWebhook)[0].CreateAt != o1.CreateAt {
@@ -249,7 +248,7 @@ func TestWebhookStoreGetOutgoingByTeam(t *testing.T) {
}
}
- if result := <-store.Webhook().GetOutgoingByTeam(utils.T, "123"); result.Err != nil {
+ if result := <-store.Webhook().GetOutgoingByTeam("123"); result.Err != nil {
t.Fatal(result.Err)
} else {
if len(result.Data.([]*model.OutgoingWebhook)) != 0 {
@@ -267,9 +266,9 @@ func TestWebhookStoreDeleteOutgoing(t *testing.T) {
o1.TeamId = model.NewId()
o1.CallbackURLs = []string{"http://nowhere.com/"}
- o1 = (<-store.Webhook().SaveOutgoing(utils.T, o1)).Data.(*model.OutgoingWebhook)
+ o1 = (<-store.Webhook().SaveOutgoing(o1)).Data.(*model.OutgoingWebhook)
- if r1 := <-store.Webhook().GetOutgoing(utils.T, o1.Id); r1.Err != nil {
+ if r1 := <-store.Webhook().GetOutgoing(o1.Id); r1.Err != nil {
t.Fatal(r1.Err)
} else {
if r1.Data.(*model.OutgoingWebhook).CreateAt != o1.CreateAt {
@@ -277,11 +276,11 @@ func TestWebhookStoreDeleteOutgoing(t *testing.T) {
}
}
- if r2 := <-store.Webhook().DeleteOutgoing(utils.T, o1.Id, model.GetMillis()); r2.Err != nil {
+ if r2 := <-store.Webhook().DeleteOutgoing(o1.Id, model.GetMillis()); r2.Err != nil {
t.Fatal(r2.Err)
}
- if r3 := (<-store.Webhook().GetOutgoing(utils.T, o1.Id)); r3.Err == nil {
+ if r3 := (<-store.Webhook().GetOutgoing(o1.Id)); r3.Err == nil {
t.Log(r3.Data)
t.Fatal("Missing id should have failed")
}
@@ -296,9 +295,9 @@ func TestWebhookStoreDeleteOutgoingByUser(t *testing.T) {
o1.TeamId = model.NewId()
o1.CallbackURLs = []string{"http://nowhere.com/"}
- o1 = (<-store.Webhook().SaveOutgoing(utils.T, o1)).Data.(*model.OutgoingWebhook)
+ o1 = (<-store.Webhook().SaveOutgoing(o1)).Data.(*model.OutgoingWebhook)
- if r1 := <-store.Webhook().GetOutgoing(utils.T, o1.Id); r1.Err != nil {
+ if r1 := <-store.Webhook().GetOutgoing(o1.Id); r1.Err != nil {
t.Fatal(r1.Err)
} else {
if r1.Data.(*model.OutgoingWebhook).CreateAt != o1.CreateAt {
@@ -306,11 +305,11 @@ func TestWebhookStoreDeleteOutgoingByUser(t *testing.T) {
}
}
- if r2 := <-store.Webhook().PermanentDeleteOutgoingByUser(utils.T, o1.CreatorId); r2.Err != nil {
+ if r2 := <-store.Webhook().PermanentDeleteOutgoingByUser(o1.CreatorId); r2.Err != nil {
t.Fatal(r2.Err)
}
- if r3 := (<-store.Webhook().GetOutgoing(utils.T, o1.Id)); r3.Err == nil {
+ if r3 := (<-store.Webhook().GetOutgoing(o1.Id)); r3.Err == nil {
t.Log(r3.Data)
t.Fatal("Missing id should have failed")
}
@@ -325,11 +324,11 @@ func TestWebhookStoreUpdateOutgoing(t *testing.T) {
o1.TeamId = model.NewId()
o1.CallbackURLs = []string{"http://nowhere.com/"}
- o1 = (<-store.Webhook().SaveOutgoing(utils.T, o1)).Data.(*model.OutgoingWebhook)
+ o1 = (<-store.Webhook().SaveOutgoing(o1)).Data.(*model.OutgoingWebhook)
o1.Token = model.NewId()
- if r2 := <-store.Webhook().UpdateOutgoing(utils.T, o1); r2.Err != nil {
+ if r2 := <-store.Webhook().UpdateOutgoing(o1); r2.Err != nil {
t.Fatal(r2.Err)
}
}
diff --git a/store/store.go b/store/store.go
index e50fc23bc..179cfecd7 100644
--- a/store/store.go
+++ b/store/store.go
@@ -4,11 +4,9 @@
package store
import (
- "time"
-
l4g "github.com/alecthomas/log4go"
"github.com/mattermost/platform/model"
- goi18n "github.com/nicksnyder/go-i18n/i18n"
+ "time"
)
type StoreResult struct {
@@ -45,150 +43,150 @@ type Store interface {
}
type TeamStore interface {
- Save(T goi18n.TranslateFunc, team *model.Team) StoreChannel
- Update(T goi18n.TranslateFunc, team *model.Team) StoreChannel
- UpdateDisplayName(T goi18n.TranslateFunc, name string, teamId string) StoreChannel
- Get(T goi18n.TranslateFunc, id string) StoreChannel
- GetByName(T goi18n.TranslateFunc, name string) StoreChannel
- GetTeamsForEmail(T goi18n.TranslateFunc, domain string) StoreChannel
- GetAll(T goi18n.TranslateFunc) StoreChannel
- GetAllTeamListing(T goi18n.TranslateFunc) StoreChannel
- GetByInviteId(T goi18n.TranslateFunc, inviteId string) StoreChannel
- PermanentDelete(T goi18n.TranslateFunc, teamId string) StoreChannel
+ Save(team *model.Team) StoreChannel
+ Update(team *model.Team) StoreChannel
+ UpdateDisplayName(name string, teamId string) StoreChannel
+ Get(id string) StoreChannel
+ GetByName(name string) StoreChannel
+ GetTeamsForEmail(domain string) StoreChannel
+ GetAll() StoreChannel
+ GetAllTeamListing() StoreChannel
+ GetByInviteId(inviteId string) StoreChannel
+ PermanentDelete(teamId string) StoreChannel
}
type ChannelStore interface {
- 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
+ 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
}
type PostStore interface {
- Save(T goi18n.TranslateFunc, post *model.Post) StoreChannel
- Update(T goi18n.TranslateFunc, post *model.Post, newMessage string, newHashtags string) StoreChannel
- Get(T goi18n.TranslateFunc, id string) StoreChannel
- Delete(T goi18n.TranslateFunc, postId string, time int64) StoreChannel
- PermanentDeleteByUser(T goi18n.TranslateFunc, userId string) StoreChannel
- GetPosts(T goi18n.TranslateFunc, channelId string, offset int, limit int) StoreChannel
- GetPostsBefore(T goi18n.TranslateFunc, channelId string, postId string, numPosts int, offset int) StoreChannel
- GetPostsAfter(T goi18n.TranslateFunc, channelId string, postId string, numPosts int, offset int) StoreChannel
- GetPostsSince(T goi18n.TranslateFunc, channelId string, time int64) StoreChannel
- GetEtag(T goi18n.TranslateFunc, channelId string) StoreChannel
- Search(T goi18n.TranslateFunc, teamId string, userId string, params *model.SearchParams) StoreChannel
- GetForExport(T goi18n.TranslateFunc, channelId string) StoreChannel
- AnalyticsUserCountsWithPostsByDay(T goi18n.TranslateFunc, teamId string) StoreChannel
- AnalyticsPostCountsByDay(T goi18n.TranslateFunc, teamId string) StoreChannel
- AnalyticsPostCount(T goi18n.TranslateFunc, teamId string) StoreChannel
+ Save(post *model.Post) StoreChannel
+ Update(post *model.Post, newMessage string, newHashtags string) StoreChannel
+ Get(id string) StoreChannel
+ Delete(postId string, time int64) StoreChannel
+ PermanentDeleteByUser(userId string) StoreChannel
+ GetPosts(channelId string, offset int, limit int) StoreChannel
+ GetPostsBefore(channelId string, postId string, numPosts int, offset int) StoreChannel
+ GetPostsAfter(channelId string, postId string, numPosts int, offset int) StoreChannel
+ GetPostsSince(channelId string, time int64) StoreChannel
+ GetEtag(channelId string) StoreChannel
+ Search(teamId string, userId string, params *model.SearchParams) StoreChannel
+ GetForExport(channelId string) StoreChannel
+ AnalyticsUserCountsWithPostsByDay(teamId string) StoreChannel
+ AnalyticsPostCountsByDay(teamId string) StoreChannel
+ AnalyticsPostCount(teamId string) StoreChannel
}
type UserStore interface {
- Save(T goi18n.TranslateFunc, user *model.User) StoreChannel
- Update(T goi18n.TranslateFunc, user *model.User, allowRoleUpdate bool) StoreChannel
- UpdateLastPictureUpdate(T goi18n.TranslateFunc, userId string) StoreChannel
- UpdateLastPingAt(T goi18n.TranslateFunc, userId string, time int64) StoreChannel
- UpdateLastActivityAt(T goi18n.TranslateFunc, userId string, time int64) StoreChannel
- UpdateUserAndSessionActivity(T goi18n.TranslateFunc, userId string, sessionId string, time int64) StoreChannel
- UpdatePassword(T goi18n.TranslateFunc, userId, newPassword string) StoreChannel
- UpdateAuthData(T goi18n.TranslateFunc, userId, service, authData string) StoreChannel
- Get(T goi18n.TranslateFunc, id string) StoreChannel
- GetProfiles(T goi18n.TranslateFunc, teamId string) StoreChannel
- GetByEmail(T goi18n.TranslateFunc, teamId string, email string) StoreChannel
- GetByAuth(T goi18n.TranslateFunc, teamId string, authData string, authService string) StoreChannel
- GetByUsername(T goi18n.TranslateFunc, teamId string, username string) StoreChannel
- VerifyEmail(T goi18n.TranslateFunc, userId string) StoreChannel
- GetEtagForProfiles(T goi18n.TranslateFunc, teamId string) StoreChannel
- UpdateFailedPasswordAttempts(T goi18n.TranslateFunc, userId string, attempts int) StoreChannel
- GetForExport(T goi18n.TranslateFunc, teamId string) StoreChannel
- GetTotalUsersCount(T goi18n.TranslateFunc) StoreChannel
- GetTotalActiveUsersCount(T goi18n.TranslateFunc) StoreChannel
- GetSystemAdminProfiles(T goi18n.TranslateFunc) StoreChannel
- PermanentDelete(T goi18n.TranslateFunc, userId string) StoreChannel
+ Save(user *model.User) StoreChannel
+ Update(user *model.User, allowRoleUpdate bool) StoreChannel
+ UpdateLastPictureUpdate(userId string) StoreChannel
+ UpdateLastPingAt(userId string, time int64) StoreChannel
+ UpdateLastActivityAt(userId string, time int64) StoreChannel
+ UpdateUserAndSessionActivity(userId string, sessionId string, time int64) StoreChannel
+ UpdatePassword(userId, newPassword string) StoreChannel
+ UpdateAuthData(userId, service, authData string) StoreChannel
+ Get(id string) StoreChannel
+ GetProfiles(teamId string) StoreChannel
+ GetByEmail(teamId string, email string) StoreChannel
+ GetByAuth(teamId string, authData string, authService string) StoreChannel
+ GetByUsername(teamId string, username string) StoreChannel
+ VerifyEmail(userId string) StoreChannel
+ GetEtagForProfiles(teamId string) StoreChannel
+ UpdateFailedPasswordAttempts(userId string, attempts int) StoreChannel
+ GetForExport(teamId string) StoreChannel
+ GetTotalUsersCount() StoreChannel
+ GetTotalActiveUsersCount() StoreChannel
+ GetSystemAdminProfiles() StoreChannel
+ PermanentDelete(userId string) StoreChannel
}
type SessionStore interface {
- Save(T goi18n.TranslateFunc, session *model.Session) StoreChannel
- Get(T goi18n.TranslateFunc, sessionIdOrToken string) StoreChannel
- GetSessions(T goi18n.TranslateFunc, userId string) StoreChannel
- Remove(T goi18n.TranslateFunc, sessionIdOrToken string) StoreChannel
- RemoveAllSessionsForTeam(T goi18n.TranslateFunc, teamId string) StoreChannel
- PermanentDeleteSessionsByUser(T goi18n.TranslateFunc, teamId string) StoreChannel
- UpdateLastActivityAt(T goi18n.TranslateFunc, sessionId string, time int64) StoreChannel
- UpdateRoles(T goi18n.TranslateFunc, userId string, roles string) StoreChannel
+ Save(session *model.Session) StoreChannel
+ Get(sessionIdOrToken string) StoreChannel
+ GetSessions(userId string) StoreChannel
+ Remove(sessionIdOrToken string) StoreChannel
+ RemoveAllSessionsForTeam(teamId string) StoreChannel
+ PermanentDeleteSessionsByUser(teamId string) StoreChannel
+ UpdateLastActivityAt(sessionId string, time int64) StoreChannel
+ UpdateRoles(userId string, roles string) StoreChannel
}
type AuditStore interface {
- Save(T goi18n.TranslateFunc, audit *model.Audit) StoreChannel
- Get(T goi18n.TranslateFunc, user_id string, limit int) StoreChannel
- PermanentDeleteByUser(T goi18n.TranslateFunc, userId string) StoreChannel
+ Save(audit *model.Audit) StoreChannel
+ Get(user_id string, limit int) StoreChannel
+ PermanentDeleteByUser(userId string) StoreChannel
}
type OAuthStore interface {
- SaveApp(T goi18n.TranslateFunc, app *model.OAuthApp) StoreChannel
- UpdateApp(T goi18n.TranslateFunc, app *model.OAuthApp) StoreChannel
- GetApp(T goi18n.TranslateFunc, id string) StoreChannel
- GetAppByUser(T goi18n.TranslateFunc, userId string) StoreChannel
- SaveAuthData(T goi18n.TranslateFunc, authData *model.AuthData) StoreChannel
- GetAuthData(T goi18n.TranslateFunc, code string) StoreChannel
- RemoveAuthData(T goi18n.TranslateFunc, code string) StoreChannel
- PermanentDeleteAuthDataByUser(T goi18n.TranslateFunc, userId string) StoreChannel
- SaveAccessData(T goi18n.TranslateFunc, accessData *model.AccessData) StoreChannel
- GetAccessData(T goi18n.TranslateFunc, token string) StoreChannel
- GetAccessDataByAuthCode(T goi18n.TranslateFunc, authCode string) StoreChannel
- RemoveAccessData(T goi18n.TranslateFunc, token string) StoreChannel
+ SaveApp(app *model.OAuthApp) StoreChannel
+ UpdateApp(app *model.OAuthApp) StoreChannel
+ GetApp(id string) StoreChannel
+ GetAppByUser(userId string) StoreChannel
+ SaveAuthData(authData *model.AuthData) StoreChannel
+ GetAuthData(code string) StoreChannel
+ RemoveAuthData(code string) StoreChannel
+ PermanentDeleteAuthDataByUser(userId string) StoreChannel
+ SaveAccessData(accessData *model.AccessData) StoreChannel
+ GetAccessData(token string) StoreChannel
+ GetAccessDataByAuthCode(authCode string) StoreChannel
+ RemoveAccessData(token string) StoreChannel
}
type SystemStore interface {
- Save(T goi18n.TranslateFunc, system *model.System) StoreChannel
- Update(T goi18n.TranslateFunc, system *model.System) StoreChannel
- Get(T goi18n.TranslateFunc) StoreChannel
+ Save(system *model.System) StoreChannel
+ Update(system *model.System) StoreChannel
+ Get() StoreChannel
}
type WebhookStore interface {
- SaveIncoming(T goi18n.TranslateFunc, webhook *model.IncomingWebhook) StoreChannel
- GetIncoming(T goi18n.TranslateFunc, id string) StoreChannel
- GetIncomingByUser(T goi18n.TranslateFunc, userId string) StoreChannel
- GetIncomingByChannel(T goi18n.TranslateFunc, channelId string) StoreChannel
- DeleteIncoming(T goi18n.TranslateFunc, webhookId string, time int64) StoreChannel
- PermanentDeleteIncomingByUser(T goi18n.TranslateFunc, userId string) StoreChannel
- SaveOutgoing(T goi18n.TranslateFunc, webhook *model.OutgoingWebhook) StoreChannel
- GetOutgoing(T goi18n.TranslateFunc, id string) StoreChannel
- GetOutgoingByCreator(T goi18n.TranslateFunc, userId string) StoreChannel
- GetOutgoingByChannel(T goi18n.TranslateFunc, channelId string) StoreChannel
- GetOutgoingByTeam(T goi18n.TranslateFunc, teamId string) StoreChannel
- DeleteOutgoing(T goi18n.TranslateFunc, webhookId string, time int64) StoreChannel
- PermanentDeleteOutgoingByUser(T goi18n.TranslateFunc, userId string) StoreChannel
- UpdateOutgoing(T goi18n.TranslateFunc, hook *model.OutgoingWebhook) StoreChannel
+ SaveIncoming(webhook *model.IncomingWebhook) StoreChannel
+ GetIncoming(id string) StoreChannel
+ GetIncomingByUser(userId string) StoreChannel
+ GetIncomingByChannel(channelId string) StoreChannel
+ DeleteIncoming(webhookId string, time int64) StoreChannel
+ PermanentDeleteIncomingByUser(userId string) StoreChannel
+ SaveOutgoing(webhook *model.OutgoingWebhook) StoreChannel
+ GetOutgoing(id string) StoreChannel
+ GetOutgoingByCreator(userId string) StoreChannel
+ GetOutgoingByChannel(channelId string) StoreChannel
+ GetOutgoingByTeam(teamId string) StoreChannel
+ DeleteOutgoing(webhookId string, time int64) StoreChannel
+ PermanentDeleteOutgoingByUser(userId string) StoreChannel
+ UpdateOutgoing(hook *model.OutgoingWebhook) StoreChannel
}
type PreferenceStore interface {
- Save(T goi18n.TranslateFunc, preferences *model.Preferences) StoreChannel
- Get(T goi18n.TranslateFunc, userId string, category string, name string) StoreChannel
- GetCategory(T goi18n.TranslateFunc, userId string, category string) StoreChannel
- GetAll(T goi18n.TranslateFunc, userId string) StoreChannel
- PermanentDeleteByUser(T goi18n.TranslateFunc, userId string) StoreChannel
- IsFeatureEnabled(T goi18n.TranslateFunc, feature, userId string) StoreChannel
+ Save(preferences *model.Preferences) StoreChannel
+ Get(userId string, category string, name string) StoreChannel
+ GetCategory(userId string, category string) StoreChannel
+ GetAll(userId string) StoreChannel
+ PermanentDeleteByUser(userId string) StoreChannel
+ IsFeatureEnabled(feature, userId string) StoreChannel
}