mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fixed display of pinned chats from main list in forward box.
This commit is contained in:
parent
c03c19d26f
commit
9e83562bf4
1 changed files with 23 additions and 9 deletions
|
@ -2061,18 +2061,32 @@ QPointer<Ui::BoxContent> ShowForwardMessagesBox(
|
||||||
if (list.size() <= 1) {
|
if (list.size() <= 1) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
const auto pinned = filters.chatsList(id)->pinned()->order();
|
const auto pinned = [&] {
|
||||||
|
const auto &list = id
|
||||||
|
? filters.chatsList(id)
|
||||||
|
: session->data().chatsList(nullptr);
|
||||||
|
const auto pinned = list->pinned()->order();
|
||||||
|
auto peers = std::vector<not_null<PeerData*>>();
|
||||||
|
peers.reserve(pinned.size());
|
||||||
|
auto foundSelf = !!id;
|
||||||
|
for (const auto &pin : pinned) {
|
||||||
|
if (!foundSelf && pin.peer()->isSelf()) {
|
||||||
|
peers.insert(peers.begin(), pin.peer());
|
||||||
|
foundSelf = true;
|
||||||
|
} else {
|
||||||
|
peers.push_back(pin.peer());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!foundSelf) {
|
||||||
|
peers.insert(peers.begin(), session->user());
|
||||||
|
}
|
||||||
|
return peers;
|
||||||
|
}();
|
||||||
box->peerListSortRows([&](
|
box->peerListSortRows([&](
|
||||||
const PeerListRow &r1,
|
const PeerListRow &r1,
|
||||||
const PeerListRow &r2) {
|
const PeerListRow &r2) {
|
||||||
const auto it1 = ranges::find_if(pinned, [&](
|
const auto it1 = ranges::find(pinned, r1.peer());
|
||||||
const Dialogs::Key &k) {
|
const auto it2 = ranges::find(pinned, r2.peer());
|
||||||
return k.peer() == r1.peer();
|
|
||||||
});
|
|
||||||
const auto it2 = ranges::find_if(pinned, [&](
|
|
||||||
const Dialogs::Key &k) {
|
|
||||||
return k.peer() == r2.peer();
|
|
||||||
});
|
|
||||||
if (it1 == pinned.end() && it2 != pinned.end()) {
|
if (it1 == pinned.end() && it2 != pinned.end()) {
|
||||||
return false;
|
return false;
|
||||||
} else if (it2 == pinned.end() && it1 != pinned.end()) {
|
} else if (it2 == pinned.end() && it1 != pinned.end()) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue