diff options
author | hmhealey <harrisonmhealey@gmail.com> | 2015-09-30 12:28:28 -0400 |
---|---|---|
committer | hmhealey <harrisonmhealey@gmail.com> | 2015-10-01 08:31:17 -0400 |
commit | c9a0030551f289241407743fbd21080cd8a358a4 (patch) | |
tree | 03019a8ad970ebd66d7f5bd1a84d11fcdb76f1ff /store | |
parent | c16b9de8dc4924cf2fb243579284e67f55cf3a47 (diff) | |
download | chat-c9a0030551f289241407743fbd21080cd8a358a4.tar.gz chat-c9a0030551f289241407743fbd21080cd8a358a4.tar.bz2 chat-c9a0030551f289241407743fbd21080cd8a358a4.zip |
Moved ChannelMember.NotifyLevel into ChannelMember.NotifyProps
Diffstat (limited to 'store')
-rw-r--r-- | store/sql_channel_store.go | 33 | ||||
-rw-r--r-- | store/sql_channel_store_test.go | 16 | ||||
-rw-r--r-- | store/sql_post_store_test.go | 1 | ||||
-rw-r--r-- | store/store.go | 1 |
4 files changed, 1 insertions, 50 deletions
diff --git a/store/sql_channel_store.go b/store/sql_channel_store.go index f453c3589..3bbe7e716 100644 --- a/store/sql_channel_store.go +++ b/store/sql_channel_store.go @@ -78,8 +78,7 @@ func (s SqlChannelStore) UpgradeSchemaIfNeeded() { l4g.Error(err.Error()) } - // TODO uncomment me - // s.RemoveColumnIfExists("ChannelMembers", "NotifyLevel") + s.RemoveColumnIfExists("ChannelMembers", "NotifyLevel") } } @@ -721,36 +720,6 @@ func (s SqlChannelStore) IncrementMentionCount(channelId string, userId string) return storeChannel } -// TODO remove me -func (s SqlChannelStore) UpdateNotifyLevel(channelId, userId, notifyLevel string) StoreChannel { - storeChannel := make(StoreChannel) - - go func() { - result := StoreResult{} - - updateAt := model.GetMillis() - - _, err := s.GetMaster().Exec( - `UPDATE - ChannelMembers - SET - NotifyLevel = :NotifyLevel, - LastUpdateAt = :LastUpdateAt - WHERE - UserId = :UserId - AND ChannelId = :ChannelId`, - map[string]interface{}{"ChannelId": channelId, "UserId": userId, "NotifyLevel": notifyLevel, "LastUpdateAt": updateAt}) - if err != nil { - result.Err = model.NewAppError("SqlChannelStore.UpdateNotifyLevel", "We couldn't update the notify level", "channel_id="+channelId+", user_id="+userId+", "+err.Error()) - } - - storeChannel <- result - close(storeChannel) - }() - - return storeChannel -} - func (s SqlChannelStore) GetForExport(teamId string) StoreChannel { storeChannel := make(StoreChannel) diff --git a/store/sql_channel_store_test.go b/store/sql_channel_store_test.go index 45c05645e..b6d05684b 100644 --- a/store/sql_channel_store_test.go +++ b/store/sql_channel_store_test.go @@ -135,14 +135,12 @@ func TestChannelStoreDelete(t *testing.T) { m1 := model.ChannelMember{} m1.ChannelId = o1.Id m1.UserId = model.NewId() - m1.NotifyLevel = model.CHANNEL_NOTIFY_ALL m1.NotifyProps = model.GetDefaultChannelNotifyProps() Must(store.Channel().SaveMember(&m1)) m2 := model.ChannelMember{} m2.ChannelId = o2.Id m2.UserId = m1.UserId - m2.NotifyLevel = model.CHANNEL_NOTIFY_ALL m2.NotifyProps = model.GetDefaultChannelNotifyProps() Must(store.Channel().SaveMember(&m2)) @@ -224,14 +222,12 @@ func TestChannelMemberStore(t *testing.T) { o1 := model.ChannelMember{} o1.ChannelId = c1.Id o1.UserId = u1.Id - o1.NotifyLevel = model.CHANNEL_NOTIFY_ALL o1.NotifyProps = model.GetDefaultChannelNotifyProps() Must(store.Channel().SaveMember(&o1)) o2 := model.ChannelMember{} o2.ChannelId = c1.Id o2.UserId = u2.Id - o2.NotifyLevel = model.CHANNEL_NOTIFY_ALL o2.NotifyProps = model.GetDefaultChannelNotifyProps() Must(store.Channel().SaveMember(&o2)) @@ -295,7 +291,6 @@ func TestChannelStorePermissionsTo(t *testing.T) { m1 := model.ChannelMember{} m1.ChannelId = o1.Id m1.UserId = model.NewId() - m1.NotifyLevel = model.CHANNEL_NOTIFY_ALL m1.NotifyProps = model.GetDefaultChannelNotifyProps() Must(store.Channel().SaveMember(&m1)) @@ -376,21 +371,18 @@ func TestChannelStoreGetChannels(t *testing.T) { m1 := model.ChannelMember{} m1.ChannelId = o1.Id m1.UserId = model.NewId() - m1.NotifyLevel = model.CHANNEL_NOTIFY_ALL m1.NotifyProps = model.GetDefaultChannelNotifyProps() Must(store.Channel().SaveMember(&m1)) m2 := model.ChannelMember{} m2.ChannelId = o1.Id m2.UserId = model.NewId() - m2.NotifyLevel = model.CHANNEL_NOTIFY_ALL m2.NotifyProps = model.GetDefaultChannelNotifyProps() Must(store.Channel().SaveMember(&m2)) m3 := model.ChannelMember{} m3.ChannelId = o2.Id m3.UserId = model.NewId() - m3.NotifyLevel = model.CHANNEL_NOTIFY_ALL m3.NotifyProps = model.GetDefaultChannelNotifyProps() Must(store.Channel().SaveMember(&m3)) @@ -422,21 +414,18 @@ func TestChannelStoreGetMoreChannels(t *testing.T) { m1 := model.ChannelMember{} m1.ChannelId = o1.Id m1.UserId = model.NewId() - m1.NotifyLevel = model.CHANNEL_NOTIFY_ALL m1.NotifyProps = model.GetDefaultChannelNotifyProps() Must(store.Channel().SaveMember(&m1)) m2 := model.ChannelMember{} m2.ChannelId = o1.Id m2.UserId = model.NewId() - m2.NotifyLevel = model.CHANNEL_NOTIFY_ALL m2.NotifyProps = model.GetDefaultChannelNotifyProps() Must(store.Channel().SaveMember(&m2)) m3 := model.ChannelMember{} m3.ChannelId = o2.Id m3.UserId = model.NewId() - m3.NotifyLevel = model.CHANNEL_NOTIFY_ALL m3.NotifyProps = model.GetDefaultChannelNotifyProps() Must(store.Channel().SaveMember(&m3)) @@ -493,21 +482,18 @@ func TestChannelStoreGetChannelCounts(t *testing.T) { m1 := model.ChannelMember{} m1.ChannelId = o1.Id m1.UserId = model.NewId() - m1.NotifyLevel = model.CHANNEL_NOTIFY_ALL m1.NotifyProps = model.GetDefaultChannelNotifyProps() Must(store.Channel().SaveMember(&m1)) m2 := model.ChannelMember{} m2.ChannelId = o1.Id m2.UserId = model.NewId() - m2.NotifyLevel = model.CHANNEL_NOTIFY_ALL m2.NotifyProps = model.GetDefaultChannelNotifyProps() Must(store.Channel().SaveMember(&m2)) m3 := model.ChannelMember{} m3.ChannelId = o2.Id m3.UserId = model.NewId() - m3.NotifyLevel = model.CHANNEL_NOTIFY_ALL m3.NotifyProps = model.GetDefaultChannelNotifyProps() Must(store.Channel().SaveMember(&m3)) @@ -537,7 +523,6 @@ func TestChannelStoreUpdateLastViewedAt(t *testing.T) { m1 := model.ChannelMember{} m1.ChannelId = o1.Id m1.UserId = model.NewId() - m1.NotifyLevel = model.CHANNEL_NOTIFY_ALL m1.NotifyProps = model.GetDefaultChannelNotifyProps() Must(store.Channel().SaveMember(&m1)) @@ -566,7 +551,6 @@ func TestChannelStoreIncrementMentionCount(t *testing.T) { m1 := model.ChannelMember{} m1.ChannelId = o1.Id m1.UserId = model.NewId() - m1.NotifyLevel = model.CHANNEL_NOTIFY_ALL m1.NotifyProps = model.GetDefaultChannelNotifyProps() Must(store.Channel().SaveMember(&m1)) diff --git a/store/sql_post_store_test.go b/store/sql_post_store_test.go index c8f7e7587..6a6364dc8 100644 --- a/store/sql_post_store_test.go +++ b/store/sql_post_store_test.go @@ -484,7 +484,6 @@ func TestPostStoreSearch(t *testing.T) { m1 := model.ChannelMember{} m1.ChannelId = c1.Id m1.UserId = userId - m1.NotifyLevel = model.CHANNEL_NOTIFY_ALL m1.NotifyProps = model.GetDefaultChannelNotifyProps() Must(store.Channel().SaveMember(&m1)) diff --git a/store/store.go b/store/store.go index 2cffe99de..887913bc6 100644 --- a/store/store.go +++ b/store/store.go @@ -72,7 +72,6 @@ type ChannelStore interface { CheckPermissionsToByName(teamId string, channelName string, userId string) StoreChannel UpdateLastViewedAt(channelId string, userId string) StoreChannel IncrementMentionCount(channelId string, userId string) StoreChannel - UpdateNotifyLevel(channelId string, userId string, notifyLevel string) StoreChannel } type PostStore interface { |