Pass FilterId to pinnedIndexChanged.

This commit is contained in:
John Preston 2021-12-02 11:51:54 +04:00
parent 894e7c5828
commit c4c234f0d3
2 changed files with 7 additions and 10 deletions

View File

@ -63,8 +63,8 @@ Data::Folder *Entry::asFolder() {
return _isFolder ? static_cast<Data::Folder*>(this) : nullptr; return _isFolder ? static_cast<Data::Folder*>(this) : nullptr;
} }
void Entry::pinnedIndexChanged(int was, int now) { void Entry::pinnedIndexChanged(FilterId filterId, int was, int now) {
if (session().supportMode()) { if (!filterId && session().supportMode()) {
// Force reorder in support mode. // Force reorder in support mode.
_sortKeyInChatList = 0; _sortKeyInChatList = 0;
} }
@ -83,15 +83,12 @@ void Entry::cachePinnedIndex(FilterId filterId, int index) {
} }
if (!index) { if (!index) {
_pinnedIndex.erase(i); _pinnedIndex.erase(i);
pinnedIndexChanged(was, index); } else if (!was) {
_pinnedIndex.emplace(filterId, index);
} else { } else {
if (!was) { i->second = index;
_pinnedIndex.emplace(filterId, index);
} else {
i->second = index;
}
pinnedIndexChanged(was, index);
} }
pinnedIndexChanged(filterId, was, index);
} }
void Entry::cacheTopPromoted(bool promoted) { void Entry::cacheTopPromoted(bool promoted) {

View File

@ -205,7 +205,7 @@ protected:
private: private:
virtual void changedChatListPinHook(); virtual void changedChatListPinHook();
void pinnedIndexChanged(int was, int now); void pinnedIndexChanged(FilterId filterId, int was, int now);
[[nodiscard]] uint64 computeSortPosition(FilterId filterId) const; [[nodiscard]] uint64 computeSortPosition(FilterId filterId) const;
void setChatListExistence(bool exists); void setChatListExistence(bool exists);