Browse Source

Fix instant reading voice/round messages

master
morethanwords 3 years ago
parent
commit
0014fd6319
  1. 4
      src/components/chat/bubbles.ts
  2. 10
      src/lib/appManagers/appMessagesManager.ts

4
src/components/chat/bubbles.ts

@ -776,7 +776,7 @@ export default class ChatBubbles { @@ -776,7 +776,7 @@ export default class ChatBubbles {
const readContents: number[] = [];
for(const mid of this.unreadedSeen) {
const message: MyMessage = this.chat.getMessage(mid);
if(message.pFlags.media_unread) {
if(this.appMessagesManager.isMentionUnread(message)) {
readContents.push(mid);
}
}
@ -2170,7 +2170,7 @@ export default class ChatBubbles { @@ -2170,7 +2170,7 @@ export default class ChatBubbles {
if(!our && !message.pFlags.out && this.unreadedObserver) {
//this.log('not our message', message, message.pFlags.unread);
const isUnread = message.pFlags.unread ||
(message.pFlags.media_unread && message.pFlags.mentioned) ||
this.appMessagesManager.isMentionUnread(message) ||
(this.historyStorage.readMaxId !== undefined && this.historyStorage.readMaxId < message.mid);
if(isUnread) {
this.unreadedObserver.observe(bubble);

10
src/lib/appManagers/appMessagesManager.ts

@ -5438,6 +5438,16 @@ export class AppMessagesManager { @@ -5438,6 +5438,16 @@ export class AppMessagesManager {
)
);
}
public isMentionUnread(message: MyMessage) {
const doc = ((message as Message.message).media as MessageMedia.messageMediaDocument)?.document as MyDocument;
return message.pFlags.media_unread &&
message.pFlags.mentioned &&
(
!doc ||
!(['voice', 'round'] as MyDocument['type'][]).includes(doc.type)
);
}
}
const appMessagesManager = new AppMessagesManager();

Loading…
Cancel
Save