Fix adding first chat to archive.

This commit is contained in:
John Preston 2019-04-24 18:53:12 +04:00
parent 52b9212625
commit 4c571f5bff
1 changed files with 5 additions and 2 deletions

View File

@ -101,10 +101,13 @@ void Folder::indexNameParts() {
} }
void Folder::registerOne(not_null<History*> history) { void Folder::registerOne(not_null<History*> history) {
++_chatListViewVersion;
if (_chatsList.indexed()->size() == 1) { if (_chatsList.indexed()->size() == 1) {
updateChatListSortPosition(); updateChatListSortPosition();
if (!_cloudUnread.messagesCount.has_value()) {
session().api().requestDialogEntry(this);
}
} else { } else {
++_chatListViewVersion;
updateChatListEntry(); updateChatListEntry();
} }
applyChatListMessage(history->chatListMessage()); applyChatListMessage(history->chatListMessage());
@ -315,6 +318,7 @@ TimeId Folder::adjustedChatListTimeId() const {
} }
void Folder::applyDialog(const MTPDdialogFolder &data) { void Folder::applyDialog(const MTPDdialogFolder &data) {
updateCloudUnread(data);
if (const auto peerId = peerFromMTP(data.vpeer)) { if (const auto peerId = peerFromMTP(data.vpeer)) {
const auto history = owner().history(peerId); const auto history = owner().history(peerId);
const auto fullId = FullMsgId( const auto fullId = FullMsgId(
@ -325,7 +329,6 @@ void Folder::applyDialog(const MTPDdialogFolder &data) {
_chatsList.clear(); _chatsList.clear();
updateChatListExistence(); updateChatListExistence();
} }
updateCloudUnread(data);
if (_chatsList.indexed()->size() < kLoadedChatsMinCount) { if (_chatsList.indexed()->size() < kLoadedChatsMinCount) {
session().api().requestDialogs(this); session().api().requestDialogs(this);
} }