2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-30 22:25:12 +00:00

Fix client side generated changelogs display.

Also use message date if available in MediaView.
This commit is contained in:
John Preston
2018-09-27 23:31:48 +03:00
parent 352fc55234
commit a70613d929
17 changed files with 141 additions and 198 deletions

View File

@@ -2176,8 +2176,13 @@ void History::markFullyLoaded() {
void History::setLastMessage(HistoryItem *item) {
if (item) {
if (_lastMessage && !*_lastMessage) {
Local::removeSavedPeer(peer);
if (_lastMessage) {
if (!*_lastMessage) {
Local::removeSavedPeer(peer);
} else if (!IsServerMsgId((*_lastMessage)->id)
&& (*_lastMessage)->date() > item->date()) {
return;
}
}
_lastMessage = item;
if (const auto feed = peer->feed()) {
@@ -2280,12 +2285,25 @@ void History::applyDialog(const MTPDdialog &data) {
}
}
bool History::skipUnreadUpdateForClientSideUnread() const {
if (peer->id != peerFromUser(ServiceUserId)) {
return false;
} else if (!_unreadCount || !*_unreadCount) {
return false;
} else if (!_lastMessage || IsServerMsgId((*_lastMessage)->id)) {
return false;
}
return true;
}
void History::applyDialogFields(
int unreadCount,
MsgId maxInboxRead,
MsgId maxOutboxRead) {
setUnreadCount(unreadCount);
setInboxReadTill(maxInboxRead);
if (!skipUnreadUpdateForClientSideUnread()) {
setUnreadCount(unreadCount);
setInboxReadTill(maxInboxRead);
}
setOutboxReadTill(maxOutboxRead);
}