diff options
author | Harrison Healey <harrisonmhealey@gmail.com> | 2016-08-18 18:45:35 -0400 |
---|---|---|
committer | Corey Hulen <corey@hulen.com> | 2016-08-18 14:45:35 -0800 |
commit | 9ad50d4d7562c1b029c888e892dd7cfc203f938a (patch) | |
tree | 0c173f204eb20e06a116762c2a378a742210c0db /store/sql_user_store.go | |
parent | 3289c856130c4d1956dda9229fb3c6a060655b1a (diff) | |
download | chat-9ad50d4d7562c1b029c888e892dd7cfc203f938a.tar.gz chat-9ad50d4d7562c1b029c888e892dd7cfc203f938a.tar.bz2 chat-9ad50d4d7562c1b029c888e892dd7cfc203f938a.zip |
Fixed calculation of mention count for direct channels (#3831)
* Fixed clientside calculation of direct channel mention count
* Fixed serverside calculation of direct channel mention count
Diffstat (limited to 'store/sql_user_store.go')
-rw-r--r-- | store/sql_user_store.go | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/store/sql_user_store.go b/store/sql_user_store.go index 79d1d809a..e26183c1e 100644 --- a/store/sql_user_store.go +++ b/store/sql_user_store.go @@ -982,7 +982,7 @@ 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 0 END + cm.MentionCount) 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", 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 |