fix(chat/api): don't count muted chats' unviewed count unless mentioned (#3619)

This commit is contained in:
Jonathan Rainville 2023-06-16 14:10:04 -04:00 committed by GitHub
parent 9e7f1338f0
commit a46bf97bf3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 3 deletions

View File

@ -149,7 +149,9 @@ func (api *API) getChannelGroups(ctx context.Context, channelGroupID string) (ma
if !chat.IsActivePersonalChat() {
continue
}
totalUnviewedMessageCount += int(chat.UnviewedMessagesCount)
if !chat.Muted || chat.UnviewedMentionsCount > 0 {
totalUnviewedMessageCount += int(chat.UnviewedMessagesCount)
}
totalUnviewedMentionsCount += int(chat.UnviewedMentionsCount)
c, err := api.toAPIChat(chat, nil, pubKey, true)
@ -197,8 +199,9 @@ func (api *API) getChannelGroups(ctx context.Context, channelGroupID string) (ma
if chat.CommunityID != community.IDString() || !chat.Active {
continue
}
totalUnviewedMessageCount += int(chat.UnviewedMessagesCount)
if !chat.Muted || chat.UnviewedMentionsCount > 0 {
totalUnviewedMessageCount += int(chat.UnviewedMessagesCount)
}
totalUnviewedMentionsCount += int(chat.UnviewedMentionsCount)
}