2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 14:45:14 +00:00

Support pinned chats in folders.

This commit is contained in:
John Preston
2019-04-19 12:47:49 +04:00
parent 607655941d
commit 58519300ea
23 changed files with 564 additions and 304 deletions

View File

@@ -1835,6 +1835,9 @@ void History::setFolderPointer(Data::Folder *folder) {
if (_folder == folder) {
return;
}
if (isPinnedDialog()) {
owner().setChatPinned(this, false);
}
const auto wasKnown = folderKnown();
const auto wasInAll = inChatList(Mode::All);
const auto wasInImportant = wasInAll && inChatList(Mode::Important);
@@ -1864,6 +1867,18 @@ void History::setFolderPointer(Data::Folder *folder) {
}
}
void History::applyPinnedUpdate(const MTPDupdateDialogPinned &data) {
const auto folderId = data.has_folder_id() ? data.vfolder_id.v : 0;
if (!folderKnown()) {
if (folderId) {
setFolder(owner().folder(folderId));
} else {
clearFolder();
}
}
owner().setChatPinned(this, data.is_pinned());
}
TimeId History::adjustedChatListTimeId() const {
const auto result = chatListTimeId();
if (const auto draft = cloudDraft()) {