Browse Source

Fix mentions count again

master
morethanwords 3 years ago
parent
commit
d8c401b9b6
  1. 10
      src/lib/appManagers/appMessagesManager.ts

10
src/lib/appManagers/appMessagesManager.ts

@ -4089,6 +4089,13 @@ export class AppMessagesManager {
} }
} }
private fixUnreadMentionsCountIfNeeded(peerId: PeerId, slicedArray: SlicedArray) {
const dialog = this.getDialogOnly(peerId);
if(!slicedArray.length && dialog?.unread_mentions_count) {
this.reloadConversation(peerId);
}
}
public goToNextMention(peerId: PeerId) { public goToNextMention(peerId: PeerId) {
/* this.getUnreadMentions(peerId, 1, 2, 0).then(messages => { /* this.getUnreadMentions(peerId, 1, 2, 0).then(messages => {
console.log(messages); console.log(messages);
@ -4103,6 +4110,7 @@ export class AppMessagesManager {
const length = slicedArray.length; const length = slicedArray.length;
const isTopEnd = slicedArray.first.isEnd(SliceEnd.Top); const isTopEnd = slicedArray.first.isEnd(SliceEnd.Top);
if(!length && isTopEnd) { if(!length && isTopEnd) {
this.fixUnreadMentionsCountIfNeeded(peerId, slicedArray);
return Promise.resolve(); return Promise.resolve();
} }
@ -4117,6 +4125,8 @@ export class AppMessagesManager {
if(mid) { if(mid) {
slicedArray.delete(mid); slicedArray.delete(mid);
rootScope.dispatchEvent('history_focus', {peerId, mid}); rootScope.dispatchEvent('history_focus', {peerId, mid});
} else {
this.fixUnreadMentionsCountIfNeeded(peerId, slicedArray);
} }
}).finally(() => { }).finally(() => {
delete this.goToNextMentionPromises[peerId]; delete this.goToNextMentionPromises[peerId];

Loading…
Cancel
Save