Fix (#21816)
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
287bb8604f
Коммит
4d7796b68a
@@ -1401,17 +1401,13 @@ func (us SqlUserStore) AnalyticsActiveCountForPeriod(startTime int64, endTime in
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (us SqlUserStore) GetUnreadCount(userId string, isCRTEnabled bool) (int64, error) {
|
func (us SqlUserStore) GetUnreadCount(userId string, isCRTEnabled bool) (int64, error) {
|
||||||
var totalMsgCountColumn = "c.TotalMsgCount"
|
|
||||||
var msgCountColumn = "cm.MsgCount"
|
|
||||||
var mentionCountColumn = "cm.MentionCount"
|
var mentionCountColumn = "cm.MentionCount"
|
||||||
if isCRTEnabled {
|
if isCRTEnabled {
|
||||||
totalMsgCountColumn = "c.TotalMsgCountRoot"
|
|
||||||
msgCountColumn = "cm.MsgCountRoot"
|
|
||||||
mentionCountColumn = "cm.MentionCountRoot"
|
mentionCountColumn = "cm.MentionCountRoot"
|
||||||
}
|
}
|
||||||
|
|
||||||
query := `
|
query := `
|
||||||
SELECT SUM(CASE WHEN c.Type = ? THEN (` + totalMsgCountColumn + ` - ` + msgCountColumn + `) ELSE ` + mentionCountColumn + ` END)
|
SELECT SUM(` + mentionCountColumn + `)
|
||||||
FROM Channels c
|
FROM Channels c
|
||||||
INNER JOIN ChannelMembers cm
|
INNER JOIN ChannelMembers cm
|
||||||
ON cm.ChannelId = c.Id
|
ON cm.ChannelId = c.Id
|
||||||
@@ -1420,7 +1416,7 @@ func (us SqlUserStore) GetUnreadCount(userId string, isCRTEnabled bool) (int64,
|
|||||||
`
|
`
|
||||||
|
|
||||||
var count int64
|
var count int64
|
||||||
err := us.GetReplicaX().Get(&count, query, model.ChannelTypeDirect, userId)
|
err := us.GetReplicaX().Get(&count, query, userId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return count, errors.Wrapf(err, "failed to count unread Channels for userId=%s", userId)
|
return count, errors.Wrapf(err, "failed to count unread Channels for userId=%s", userId)
|
||||||
}
|
}
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user