mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-04-19 07:37:11 +02:00
Fix pinned chats in main list.
This commit is contained in:
parent
ca731968ca
commit
0870a28443
2 changed files with 20 additions and 3 deletions
|
@ -3771,6 +3771,9 @@ void Session::refreshChatListEntry(Dialogs::Key key) {
|
|||
}
|
||||
for (const auto &filter : _chatsFilters->list()) {
|
||||
const auto id = filter.id();
|
||||
if (!id) {
|
||||
continue;
|
||||
}
|
||||
const auto filterList = chatsFilters().chatsList(id);
|
||||
auto event = ChatListEntryRefresh{ .key = key, .filterId = id };
|
||||
if (filter.contains(history)) {
|
||||
|
@ -3808,7 +3811,7 @@ void Session::removeChatListEntry(Dialogs::Key key) {
|
|||
Assert(entry->folderKnown());
|
||||
for (const auto &filter : _chatsFilters->list()) {
|
||||
const auto id = filter.id();
|
||||
if (entry->inChatList(id)) {
|
||||
if (id && entry->inChatList(id)) {
|
||||
entry->removeFromChatList(id, chatsFilters().chatsList(id));
|
||||
_chatListEntryRefreshes.fire(ChatListEntryRefresh{
|
||||
.key = key,
|
||||
|
|
|
@ -132,7 +132,7 @@ struct FilterRow {
|
|||
const auto &list = session->data().chatsFilters().list();
|
||||
const auto id = filter.id();
|
||||
const auto i = ranges::find(list, id, &Data::ChatFilter::id);
|
||||
if (i != end(list)
|
||||
if ((id && i != end(list))
|
||||
&& (!check
|
||||
|| (i->flags() == filter.flags()
|
||||
&& i->always() == filter.always()
|
||||
|
@ -515,7 +515,8 @@ void FilterRowButton::paintEvent(QPaintEvent *e) {
|
|||
const auto id = row.filter.id();
|
||||
if (row.removed) {
|
||||
continue;
|
||||
} else if (!ranges::contains(list, id, &Data::ChatFilter::id)) {
|
||||
} else if (!id
|
||||
|| !ranges::contains(list, id, &Data::ChatFilter::id)) {
|
||||
result.emplace(row.button, chooseNextId());
|
||||
}
|
||||
}
|
||||
|
@ -564,6 +565,19 @@ void FilterRowButton::paintEvent(QPaintEvent *e) {
|
|||
MTP_int(newId),
|
||||
tl));
|
||||
}
|
||||
if (!ranges::contains(order, FilterId(0))) {
|
||||
auto position = 0;
|
||||
for (const auto &filter : list) {
|
||||
const auto id = filter.id();
|
||||
if (!id) {
|
||||
break;
|
||||
} else if (const auto i = ranges::find(order, id)
|
||||
; i != order.end()) {
|
||||
position = int(i - order.begin()) + 1;
|
||||
}
|
||||
}
|
||||
order.insert(order.begin() + position, FilterId(0));
|
||||
}
|
||||
auto previousId = mtpRequestId(0);
|
||||
auto &&requests = ranges::views::concat(removeRequests, addRequests);
|
||||
for (auto &request : requests) {
|
||||
|
|
Loading…
Add table
Reference in a new issue