2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Implement unpin all messages within a thread.

This commit is contained in:
John Preston
2022-11-01 09:22:21 +04:00
parent 1ac051a812
commit 6d215d3729
6 changed files with 38 additions and 9 deletions

View File

@@ -550,13 +550,25 @@ void History::unpinMessagesFor(MsgId topicRootId) {
topic->setHasPinnedMessages(false);
});
}
for (const auto &message : _messages) {
if (message->isPinned()) {
message->setIsPinned(false);
for (const auto &item : _messages) {
if (item->isPinned()) {
item->setIsPinned(false);
}
}
} else {
// #TODO forum pinned
session().storage().remove(
Storage::SharedMediaRemoveAll(
peer->id,
topicRootId,
Storage::SharedMediaType::Pinned));
if (const auto topic = peer->forumTopicFor(topicRootId)) {
topic->setHasPinnedMessages(false);
}
for (const auto &item : _messages) {
if (item->isPinned() && item->topicRootId() == topicRootId) {
item->setIsPinned(false);
}
}
}
}