From 9ad50d4d7562c1b029c888e892dd7cfc203f938a Mon Sep 17 00:00:00 2001 From: Harrison Healey Date: Thu, 18 Aug 2016 18:45:35 -0400 Subject: 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 --- store/sql_user_store.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'store/sql_user_store.go') 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 -- cgit v1.2.3-1-g7c22