diff options
author | enahum <nahumhbl@gmail.com> | 2017-03-07 13:54:25 -0300 |
---|---|---|
committer | George Goldberg <george@gberg.me> | 2017-03-07 16:54:25 +0000 |
commit | 2bea17251ef90ab62381ebecaa97fc41c2c94f99 (patch) | |
tree | 5dfad89fc4e5d48c09657d408464ead627a499f0 | |
parent | 33b8b72a026c54f121f1d0f0370d9ad2e6220a61 (diff) | |
download | chat-2bea17251ef90ab62381ebecaa97fc41c2c94f99.tar.gz chat-2bea17251ef90ab62381ebecaa97fc41c2c94f99.tar.bz2 chat-2bea17251ef90ab62381ebecaa97fc41c2c94f99.zip |
Fix badge count for push notifications (#5672)
-rw-r--r-- | store/sql_user_store.go | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/store/sql_user_store.go b/store/sql_user_store.go index 838c2a80d..23b0c3696 100644 --- a/store/sql_user_store.go +++ b/store/sql_user_store.go @@ -1179,7 +1179,13 @@ func (us SqlUserStore) GetUnreadCount(userId string) StoreChannel { go func() { result := StoreResult{} - if count, err := us.GetReplica().SelectInt("SELECT SUM(CASE WHEN c.Type = 'D' THEN (c.TotalMsgCount - cm.MsgCount) ELSE cm.MentionCount END) FROM Channels c INNER JOIN ChannelMembers cm ON cm.ChannelId = c.Id AND cm.UserId = :UserId", map[string]interface{}{"UserId": userId}); err != nil { + if count, err := us.GetReplica().SelectInt(` + SELECT SUM(CASE WHEN c.Type = 'D' THEN (c.TotalMsgCount - cm.MsgCount) ELSE cm.MentionCount END) + FROM Channels c + INNER JOIN ChannelMembers cm + ON cm.ChannelId = c.Id + AND cm.UserId = :UserId + AND c.DeleteAt = 0`, map[string]interface{}{"UserId": userId}); err != nil { result.Err = model.NewLocAppError("SqlUserStore.GetMentionCount", "store.sql_user.get_unread_count.app_error", nil, err.Error()) } else { result.Data = count |