summaryrefslogtreecommitdiffstats
path: root/store/sqlstore
diff options
context:
space:
mode:
authorJesús Espino <jespinog@gmail.com>2018-09-26 16:34:12 +0200
committerGitHub <noreply@github.com>2018-09-26 16:34:12 +0200
commit15d64fb201848002a25facc3bbffc9535a704df6 (patch)
tree558282bb4126eef469525c3cb11ea3238919e6fa /store/sqlstore
parent37e00ef916af9a5aeae760a01fa0a0cf8ca93637 (diff)
downloadchat-15d64fb201848002a25facc3bbffc9535a704df6.tar.gz
chat-15d64fb201848002a25facc3bbffc9535a704df6.tar.bz2
chat-15d64fb201848002a25facc3bbffc9535a704df6.zip
MM-7188: Cleaning push notification on every read, not only on channel switch (#9348)
* MM-7188: Cleaning push notification on every read, not only on channel switch * Removed unnecesary goroutine * Fixing tests * Applying suggestion from PR
Diffstat (limited to 'store/sqlstore')
-rw-r--r--store/sqlstore/user_store.go10
1 files changed, 10 insertions, 0 deletions
diff --git a/store/sqlstore/user_store.go b/store/sqlstore/user_store.go
index 900010ce4..941aa60e9 100644
--- a/store/sqlstore/user_store.go
+++ b/store/sqlstore/user_store.go
@@ -949,6 +949,16 @@ func (us SqlUserStore) GetUnreadCountForChannel(userId string, channelId string)
})
}
+func (us SqlUserStore) GetAnyUnreadPostCountForChannel(userId string, channelId string) store.StoreChannel {
+ return store.Do(func(result *store.StoreResult) {
+ if count, err := us.GetReplica().SelectInt("SELECT SUM(c.TotalMsgCount - cm.MsgCount) FROM Channels c INNER JOIN ChannelMembers cm ON c.Id = :ChannelId AND cm.ChannelId = :ChannelId AND cm.UserId = :UserId", map[string]interface{}{"ChannelId": channelId, "UserId": userId}); err != nil {
+ result.Err = model.NewAppError("SqlUserStore.GetMentionCountForChannel", "store.sql_user.get_unread_count_for_channel.app_error", nil, err.Error(), http.StatusInternalServerError)
+ } else {
+ result.Data = count
+ }
+ })
+}
+
func (us SqlUserStore) Search(teamId string, term string, options map[string]bool) store.StoreChannel {
return store.Do(func(result *store.StoreResult) {
searchQuery := ""