Этот коммит содержится в:
коммит произвёл
Miguel de la Cruz
родитель
9bab407f26
Коммит
2193e43aac
@@ -1187,20 +1187,21 @@ func (us SqlUserStore) AnalyticsActiveCount(timePeriod int64) store.StoreChannel
|
||||
})
|
||||
}
|
||||
|
||||
func (us SqlUserStore) GetUnreadCount(userId string) store.StoreChannel {
|
||||
return store.Do(func(result *store.StoreResult) {
|
||||
if count, err := us.GetReplica().SelectInt(`
|
||||
func (us SqlUserStore) GetUnreadCount(userId string) (int64, error) {
|
||||
query := `
|
||||
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.NewAppError("SqlUserStore.GetMentionCount", "store.sql_user.get_unread_count.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
} else {
|
||||
result.Data = count
|
||||
}
|
||||
})
|
||||
ON cm.ChannelId = c.Id
|
||||
AND cm.UserId = :UserId
|
||||
AND c.DeleteAt = 0
|
||||
`
|
||||
count, err := us.GetReplica().SelectInt(query, map[string]interface{}{"UserId": userId})
|
||||
if err != nil {
|
||||
return count, model.NewAppError("SqlUserStore.GetMentionCount", "store.sql_user.get_unread_count.app_error", nil, err.Error(), http.StatusInternalServerError)
|
||||
}
|
||||
|
||||
return count, nil
|
||||
}
|
||||
|
||||
func (us SqlUserStore) GetUnreadCountForChannel(userId string, channelId string) store.StoreChannel {
|
||||
|
||||
Ссылка в новой задаче
Block a user