2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-09-02 07:35:12 +00:00

Make filtered lists independent from folders.

This commit is contained in:
John Preston
2020-03-09 15:17:56 +04:00
parent c305246d21
commit ca3419ef24
17 changed files with 98 additions and 56 deletions

View File

@@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
#include "dialogs/dialogs_indexed_list.h"
#include "data/data_session.h"
#include "data/data_folder.h"
#include "data/data_chat_filters.h"
#include "mainwidget.h"
#include "main/main_session.h"
#include "history/history_item.h"
@@ -92,16 +93,17 @@ void Entry::updateChatListSortPosition() {
updateChatListEntry();
return;
}
_sortKeyByDate = DialogPosFromDate(adjustedChatListTimeId());
const auto fixedIndex = fixedOnTopIndex();
_sortKeyInChatList = fixedIndex
? FixedOnTopDialogPos(fixedIndex)
: isPinnedDialog()
? PinnedDialogPos(_pinnedIndex)
: DialogPosFromDate(adjustedChatListTimeId());
: _sortKeyByDate;
if (needUpdateInChatList()) {
setChatListExistence(true);
} else {
_sortKeyInChatList = 0;
_sortKeyInChatList = _sortKeyByDate = 0;
}
}
@@ -229,7 +231,9 @@ void Entry::updateChatListEntry() const {
}
not_null<IndexedList*> Entry::myChatsList(FilterId filterId) const {
return owner().chatsList(folder())->indexed(filterId);
return filterId
? owner().chatsFilters().chatsList(filterId)->indexed()
: owner().chatsList(folder())->indexed();
}
} // namespace Dialogs