diff options
author | =Corey Hulen <corey@hulen.com> | 2015-07-05 09:02:23 -0800 |
---|---|---|
committer | =Corey Hulen <corey@hulen.com> | 2015-07-05 09:02:23 -0800 |
commit | 592d68cf4134b668e3ff962d17f8aa75b1bc055f (patch) | |
tree | 6e743b07487caf5fe350439aefdf0355a7e80d9b /store/sql_channel_store.go | |
parent | 72bfc1ee2afd2fa4a34186b62f144f8f6c50d693 (diff) | |
parent | 4a3003c0dcf7d642f233493e32b07beed5d08327 (diff) | |
download | chat-592d68cf4134b668e3ff962d17f8aa75b1bc055f.tar.gz chat-592d68cf4134b668e3ff962d17f8aa75b1bc055f.tar.bz2 chat-592d68cf4134b668e3ff962d17f8aa75b1bc055f.zip |
Merge branch 'master' into mm-1391
Diffstat (limited to 'store/sql_channel_store.go')
-rw-r--r-- | store/sql_channel_store.go | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/store/sql_channel_store.go b/store/sql_channel_store.go index 592657c1c..463fce16f 100644 --- a/store/sql_channel_store.go +++ b/store/sql_channel_store.go @@ -37,6 +37,7 @@ func NewSqlChannelStore(sqlStore *SqlStore) ChannelStore { } func (s SqlChannelStore) UpgradeSchemaIfNeeded() { + s.CreateColumnIfNotExists("ChannelMembers", "LastUpdateAt", "NotifyLevel", "bigint(20)", "0") // Remove after 6/7/2015 prod push } func (s SqlChannelStore) CreateIndexesIfNotExists() { @@ -273,6 +274,7 @@ func (s SqlChannelStore) SaveMember(member *model.ChannelMember) StoreChannel { go func() { result := StoreResult{} + member.PreSave() if result.Err = member.IsValid(); result.Err != nil { storeChannel <- result return @@ -484,7 +486,8 @@ func (s SqlChannelStore) UpdateLastViewedAt(channelId string, userId string) Sto SET ChannelMembers.MentionCount = 0, ChannelMembers.MsgCount = Channels.TotalMsgCount, - ChannelMembers.LastViewedAt = Channels.LastPostAt + ChannelMembers.LastViewedAt = Channels.LastPostAt, + ChannelMembers.LastUpdateAt = Channels.LastPostAt WHERE Channels.Id = ChannelMembers.ChannelId AND UserId = ? @@ -533,15 +536,18 @@ func (s SqlChannelStore) UpdateNotifyLevel(channelId, userId, notifyLevel string go func() { result := StoreResult{} + updateAt := model.GetMillis() + _, err := s.GetMaster().Exec( `UPDATE ChannelMembers SET - NotifyLevel = ? + NotifyLevel = ?, + LastUpdateAt = ? WHERE UserId = ? AND ChannelId = ?`, - notifyLevel, userId, channelId) + notifyLevel, updateAt, userId, channelId) if err != nil { result.Err = model.NewAppError("SqlChannelStore.UpdateNotifyLevel", "We couldn't update the notify level", "channel_id="+channelId+", user_id="+userId+", "+err.Error()) } |