mirror of
https://github.com/kotatogram/kotatogram-desktop
synced 2025-08-31 06:35:14 +00:00
Save pinned chats in filters to server.
This commit is contained in:
@@ -1921,6 +1921,9 @@ void History::setFolderPointer(Data::Folder *folder) {
|
||||
if (_folder == folder) {
|
||||
return;
|
||||
}
|
||||
if (isPinnedDialog(FilterId())) {
|
||||
owner().setChatPinned(this, FilterId(), false);
|
||||
}
|
||||
auto &filters = owner().chatsFilters();
|
||||
const auto wasKnown = folderKnown();
|
||||
const auto wasInList = inChatList();
|
||||
@@ -1943,7 +1946,6 @@ void History::setFolderPointer(Data::Folder *folder) {
|
||||
for (const auto &filter : filters.list()) {
|
||||
if (filter.contains(this)) {
|
||||
const auto id = filter.id();
|
||||
applyFilterPinnedIndex(id, filter);
|
||||
addToChatList(id, filters.chatsList(id));
|
||||
}
|
||||
}
|
||||
@@ -1957,24 +1959,6 @@ void History::setFolderPointer(Data::Folder *folder) {
|
||||
}
|
||||
}
|
||||
|
||||
void History::applyFilterPinnedIndex(
|
||||
FilterId filterId,
|
||||
const Data::ChatFilter &filter) {
|
||||
const auto &pinned = filter.pinned();
|
||||
const auto i = ranges::find(pinned, this);
|
||||
if (i == end(pinned)) {
|
||||
return;
|
||||
}
|
||||
const auto index = (i - begin(pinned)) + 1;
|
||||
if (index == lookupPinnedIndex(filterId)) {
|
||||
return;
|
||||
}
|
||||
owner().chatsFilters().chatsList(filterId)->pinned()->applyFilterPinned(
|
||||
filterId,
|
||||
this,
|
||||
index);
|
||||
}
|
||||
|
||||
void History::applyPinnedUpdate(const MTPDupdateDialogPinned &data) {
|
||||
const auto folderId = data.vfolder_id().value_or_empty();
|
||||
if (!folderKnown()) {
|
||||
|
Reference in New Issue
Block a user