2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-01 23:15:59 +00:00

Topics list in forum chats list entry.

This commit is contained in:
John Preston
2022-11-11 13:24:37 +04:00
parent 996b6bf46a
commit 4c8187f623
15 changed files with 395 additions and 97 deletions

View File

@@ -179,7 +179,7 @@ void Folder::reorderLastHistories() {
const auto bDate = bItem ? bItem->date() : TimeId(0);
return aDate > bDate;
};
_lastHistories.erase(_lastHistories.begin(), _lastHistories.end());
_lastHistories.clear();
_lastHistories.reserve(kShowChatNamesCount + 1);
auto &&histories = ranges::views::all(
*_chatsList.indexed()
@@ -187,11 +187,13 @@ void Folder::reorderLastHistories() {
return row->history();
}) | ranges::views::filter([](History *history) {
return (history != nullptr);
}) | ranges::views::transform([](History *history) {
return not_null<History*>(history);
});
auto nonPinnedChecked = 0;
for (const auto history : histories) {
const auto i = ranges::upper_bound(_lastHistories, history, pred);
const auto i = ranges::upper_bound(
_lastHistories,
not_null(history),
pred);
if (size(_lastHistories) < kShowChatNamesCount
|| i != end(_lastHistories)) {
_lastHistories.insert(i, history);
@@ -199,6 +201,10 @@ void Folder::reorderLastHistories() {
if (size(_lastHistories) > kShowChatNamesCount) {
_lastHistories.pop_back();
}
if (!history->isPinnedDialog(FilterId())
&& ++nonPinnedChecked >= kShowChatNamesCount) {
break;
}
}
++_chatListViewVersion;
updateChatListEntry();