Fix saved messages sublists pinning updates.
This commit is contained in:
parent
87c1329490
commit
9f738cded2
3 changed files with 27 additions and 1 deletions
|
@ -277,7 +277,7 @@ void SavedMessages::apply(const MTPDupdatePinnedSavedDialogs &update) {
|
||||||
if (!ranges::none_of(order, notLoaded)) {
|
if (!ranges::none_of(order, notLoaded)) {
|
||||||
loadPinned();
|
loadPinned();
|
||||||
} else {
|
} else {
|
||||||
_chatsList.pinned()->applyList(_owner, order);
|
_chatsList.pinned()->applyList(this, order);
|
||||||
_owner->notifyPinnedDialogsOrderUpdated();
|
_owner->notifyPinnedDialogsOrderUpdated();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
*/
|
*/
|
||||||
#include "dialogs/dialogs_pinned_list.h"
|
#include "dialogs/dialogs_pinned_list.h"
|
||||||
|
|
||||||
|
#include "data/data_saved_messages.h"
|
||||||
#include "dialogs/dialogs_key.h"
|
#include "dialogs/dialogs_key.h"
|
||||||
#include "dialogs/dialogs_entry.h"
|
#include "dialogs/dialogs_entry.h"
|
||||||
#include "history/history.h"
|
#include "history/history.h"
|
||||||
|
@ -86,6 +87,8 @@ void PinnedList::clear() {
|
||||||
void PinnedList::applyList(
|
void PinnedList::applyList(
|
||||||
not_null<Data::Session*> owner,
|
not_null<Data::Session*> owner,
|
||||||
const QVector<MTPDialogPeer> &list) {
|
const QVector<MTPDialogPeer> &list) {
|
||||||
|
Expects(this != owner->savedMessages().chatsList()->pinned());
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
for (const auto &peer : list) {
|
for (const auto &peer : list) {
|
||||||
peer.match([&](const MTPDdialogPeer &data) {
|
peer.match([&](const MTPDdialogPeer &data) {
|
||||||
|
@ -98,9 +101,28 @@ void PinnedList::applyList(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void PinnedList::applyList(
|
||||||
|
not_null<Data::SavedMessages*> sublistsOwner,
|
||||||
|
const QVector<MTPDialogPeer> &list) {
|
||||||
|
Expects(this == sublistsOwner->chatsList()->pinned());
|
||||||
|
|
||||||
|
clear();
|
||||||
|
for (const auto &peer : list) {
|
||||||
|
peer.match([&](const MTPDdialogPeer &data) {
|
||||||
|
if (const auto peerId = peerFromMTP(data.vpeer())) {
|
||||||
|
const auto peer = sublistsOwner->owner().peer(peerId);
|
||||||
|
addPinned(sublistsOwner->sublist(peer));
|
||||||
|
}
|
||||||
|
}, [](const MTPDdialogPeerFolder &data) {
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void PinnedList::applyList(
|
void PinnedList::applyList(
|
||||||
not_null<Data::Forum*> forum,
|
not_null<Data::Forum*> forum,
|
||||||
const QVector<MTPint> &list) {
|
const QVector<MTPint> &list) {
|
||||||
|
Expects(this == forum->topicsList()->pinned());
|
||||||
|
|
||||||
clear();
|
clear();
|
||||||
for (const auto &topicId : list) {
|
for (const auto &topicId : list) {
|
||||||
addPinned(forum->topicFor(topicId.v));
|
addPinned(forum->topicFor(topicId.v));
|
||||||
|
|
|
@ -10,6 +10,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
||||||
class History;
|
class History;
|
||||||
|
|
||||||
namespace Data {
|
namespace Data {
|
||||||
|
class SavedMessages;
|
||||||
class Session;
|
class Session;
|
||||||
class Forum;
|
class Forum;
|
||||||
} // namespace Data
|
} // namespace Data
|
||||||
|
@ -36,6 +37,9 @@ public:
|
||||||
void applyList(
|
void applyList(
|
||||||
not_null<Data::Session*> owner,
|
not_null<Data::Session*> owner,
|
||||||
const QVector<MTPDialogPeer> &list);
|
const QVector<MTPDialogPeer> &list);
|
||||||
|
void applyList(
|
||||||
|
not_null<Data::SavedMessages*> sublistsOwner,
|
||||||
|
const QVector<MTPDialogPeer> &list);
|
||||||
void applyList(
|
void applyList(
|
||||||
not_null<Data::Forum*> forum,
|
not_null<Data::Forum*> forum,
|
||||||
const QVector<MTPint> &list);
|
const QVector<MTPint> &list);
|
||||||
|
|
Loading…
Reference in a new issue