Fix unread mentions count
This commit is contained in:
parent
f0116837e3
commit
47325b3d48
@ -859,7 +859,7 @@ export default class ChatInput {
|
|||||||
this.goDownUnreadBadge.classList.toggle('badge-gray', this.appNotificationsManager.isPeerLocalMuted(this.chat.peerId, true));
|
this.goDownUnreadBadge.classList.toggle('badge-gray', this.appNotificationsManager.isPeerLocalMuted(this.chat.peerId, true));
|
||||||
|
|
||||||
if(this.goMentionUnreadBadge && this.chat.type === 'chat') {
|
if(this.goMentionUnreadBadge && this.chat.type === 'chat') {
|
||||||
const hasMentions = !!dialog?.unread_mentions_count;
|
const hasMentions = !!(dialog?.unread_mentions_count && dialog.unread_count);
|
||||||
this.goMentionUnreadBadge.innerText = hasMentions ? '' + (dialog.unread_mentions_count) : '';
|
this.goMentionUnreadBadge.innerText = hasMentions ? '' + (dialog.unread_mentions_count) : '';
|
||||||
this.goMentionBtn.classList.toggle('is-visible', hasMentions);
|
this.goMentionBtn.classList.toggle('is-visible', hasMentions);
|
||||||
}
|
}
|
||||||
|
@ -4618,7 +4618,7 @@ export class AppMessagesManager {
|
|||||||
foundDialog.unread_count = setCount;
|
foundDialog.unread_count = setCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(newUnreadMentionsCount < 0) {
|
if(newUnreadMentionsCount < 0 || !foundDialog.unread_count) {
|
||||||
foundDialog.unread_mentions_count = 0;
|
foundDialog.unread_mentions_count = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -4730,14 +4730,14 @@ export class AppMessagesManager {
|
|||||||
const affected = historyUpdated.unreadMentions || historyUpdated.unread;
|
const affected = historyUpdated.unreadMentions || historyUpdated.unread;
|
||||||
const releaseUnreadCount = affected && this.dialogsStorage.prepareDialogUnreadCountModifying(foundDialog);
|
const releaseUnreadCount = affected && this.dialogsStorage.prepareDialogUnreadCountModifying(foundDialog);
|
||||||
|
|
||||||
if(historyUpdated.unreadMentions) {
|
|
||||||
foundDialog.unread_mentions_count = Math.max(0, foundDialog.unread_mentions_count - historyUpdated.unreadMentions);
|
|
||||||
}
|
|
||||||
|
|
||||||
if(historyUpdated.unread) {
|
if(historyUpdated.unread) {
|
||||||
foundDialog.unread_count = Math.max(0, foundDialog.unread_count - historyUpdated.unread);
|
foundDialog.unread_count = Math.max(0, foundDialog.unread_count - historyUpdated.unread);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(historyUpdated.unreadMentions) {
|
||||||
|
foundDialog.unread_mentions_count = !foundDialog.unread_count ? 0 : Math.max(0, foundDialog.unread_mentions_count - historyUpdated.unreadMentions);
|
||||||
|
}
|
||||||
|
|
||||||
if(affected) {
|
if(affected) {
|
||||||
releaseUnreadCount();
|
releaseUnreadCount();
|
||||||
rootScope.dispatchEvent('dialog_unread', {peerId});
|
rootScope.dispatchEvent('dialog_unread', {peerId});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user