summaryrefslogtreecommitdiffstats
path: root/store
diff options
context:
space:
mode:
authorJoramWilander <jwawilander@gmail.com>2015-06-22 14:23:59 -0400
committerJoramWilander <jwawilander@gmail.com>2015-06-29 07:45:12 -0400
commit2b4888d062d65546325470d2d9181f4a66a2fb00 (patch)
tree23cb6c57a055370256cb7e71781e75412b681b3c /store
parentafb62bb40a012a7e00707f384020e1431abca1ed (diff)
downloadchat-2b4888d062d65546325470d2d9181f4a66a2fb00.tar.gz
chat-2b4888d062d65546325470d2d9181f4a66a2fb00.tar.bz2
chat-2b4888d062d65546325470d2d9181f4a66a2fb00.zip
fixes mm-1316 improves channel notifications UI and updates channellist etag
Diffstat (limited to 'store')
-rw-r--r--store/sql_channel_store.go12
1 files changed, 9 insertions, 3 deletions
diff --git a/store/sql_channel_store.go b/store/sql_channel_store.go
index 592657c1c..0a1ea23fe 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")
}
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())
}