Fix unread count

This commit is contained in:
Eduard Kuzmenko 2020-02-07 09:10:08 +07:00
parent c4f58a72de
commit 546039660e
5 changed files with 20 additions and 9 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -195,6 +195,9 @@ export class AppDialogsManager {
} else if(document.type == 'voice') {
lastMessageText += '<i>Voice message</i>';
found = true;
} else if(document.type == 'gif') {
lastMessageText += '<i>GIF</i>';
found = true;
}
if(found) {

View File

@ -350,9 +350,10 @@ export class AppImManager {
if(readed.length) {
let max = Math.max(...readed);
let min = Math.min(...readed);
//appMessagesManager.readMessages(readed);
appMessagesManager.readHistory(this.peerID, max);
appMessagesManager.readHistory(this.peerID, max, min);
}
if(this.scroll.scrollHeight - (this.scroll.scrollTop + this.scroll.offsetHeight) == 0/* <= 5 */) {

View File

@ -1878,7 +1878,7 @@ export class AppMessagesManager {
this.newDialogsToHandle = {};
}
public readHistory(peerID: number, maxID = 0) {
public readHistory(peerID: number, maxID = 0, minID = 0) {
// console.trace('start read')
var isChannel = AppPeersManager.isChannel(peerID);
var historyStorage = this.historiesStorage[peerID];
@ -1971,16 +1971,18 @@ export class AppMessagesManager {
message = this.messagesStorage[messageID];
if(message && !message.pFlags.out) {
message.pFlags.unread = false;
if(this.messagesForHistory[messageID]) {
this.messagesForHistory[messageID].pFlags.unread = false;
}
if(this.messagesForDialogs[messageID]) {
this.messagesForDialogs[messageID].pFlags.unread = false;
}
//NotificationsManager.cancel('msg' + messageID); // warning
}
if(messageID == maxID) break;
if(messageID == minID) break;
}
}
@ -2372,11 +2374,10 @@ export class AppMessagesManager {
}
}
if(foundDialog[0]) {
if(!isOut &&
newUnreadCount &&
foundDialog[0].top_message <= maxID) {
if(!isOut && newUnreadCount && foundDialog[0].top_message <= maxID) {
newUnreadCount = foundDialog[0].unread_count = 0;
}
let dialogKey = isOut ? 'read_outbox_max_id' : 'read_inbox_max_id';
foundDialog[0][dialogKey] = maxID;
}

View File

@ -225,15 +225,15 @@
&.photo, &.video {
width: min-content;
.message {
/* .message {
width: min-content;
max-width: min-content;
/* .time {
max-width: min-content;
overflow: hidden;
} */
}
}
} */
.box.web {
width: min-content;
@ -241,6 +241,12 @@
}
}
&.webpage {
.time {
float: none;
}
}
img, video {
object-fit: contain;
}