summaryrefslogtreecommitdiffstats
path: root/store/sql_channel_store.go
diff options
context:
space:
mode:
authorhmhealey <harrisonmhealey@gmail.com>2015-09-23 11:38:08 -0400
committerhmhealey <harrisonmhealey@gmail.com>2015-09-30 09:59:58 -0400
commit7c319f052441c01f7c0ffd744a50b671c785591a (patch)
tree5c36d84eedd4b54801fbccd4419734eb0486f8d8 /store/sql_channel_store.go
parent4bc625e8d10ab7735b76814fe9bbf3fb9144d4e1 (diff)
downloadchat-7c319f052441c01f7c0ffd744a50b671c785591a.tar.gz
chat-7c319f052441c01f7c0ffd744a50b671c785591a.tar.bz2
chat-7c319f052441c01f7c0ffd744a50b671c785591a.zip
Removed UI for quiet mode and added UI to set when a channel will be marked unread in the sidebar
Diffstat (limited to 'store/sql_channel_store.go')
-rw-r--r--store/sql_channel_store.go30
1 files changed, 30 insertions, 0 deletions
diff --git a/store/sql_channel_store.go b/store/sql_channel_store.go
index cb686090e..892ee1398 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", "MarkUnreadLevel", "varchar(20)", "varchar(20)", model.CHANNEL_MARK_UNREAD_ALL)
}
func (s SqlChannelStore) CreateIndexesIfNotExists() {
@@ -678,6 +679,35 @@ func (s SqlChannelStore) UpdateNotifyLevel(channelId, userId, notifyLevel string
return storeChannel
}
+func (s SqlChannelStore) UpdateMarkUnreadLevel(channelId, userId, markUnreadLevel string) StoreChannel {
+ storeChannel := make(StoreChannel)
+
+ go func() {
+ result := StoreResult{}
+
+ updateAt := model.GetMillis()
+
+ _, err := s.GetMaster().Exec(
+ `UPDATE
+ ChannelMembers
+ SET
+ MarkUnreadLevel = :MarkUnreadLevel,
+ LastUpdateAt = :LastUpdateAt
+ WHERE
+ UserId = :UserId
+ AND ChannelId = :ChannelId`,
+ map[string]interface{}{"ChannelId": channelId, "UserId": userId, "MarkUnreadLevel": markUnreadLevel, "LastUpdateAt": updateAt})
+ if err != nil {
+ result.Err = model.NewAppError("SqlChannelStore.UpdateMarkUnreadLevel", "We couldn't update the mark unread 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)