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

Support shared media / pins for sublists.

This commit is contained in:
John Preston
2025-06-02 15:00:36 +04:00
parent ffe6786ad1
commit dfc1ec3ccf
83 changed files with 1105 additions and 221 deletions

View File

@@ -24,10 +24,15 @@ namespace {
[[nodiscard]] bool IsOldForPin(
MsgId id,
not_null<PeerData*> peer,
MsgId topicRootId) {
MsgId topicRootId,
PeerId monoforumPeerId) {
const auto normal = peer->migrateToOrMe();
const auto migrated = normal->migrateFrom();
const auto top = Data::ResolveTopPinnedId(normal, topicRootId, migrated);
const auto top = Data::ResolveTopPinnedId(
normal,
topicRootId,
monoforumPeerId,
migrated);
if (!top) {
return false;
} else if (peer == migrated) {
@@ -53,7 +58,14 @@ void PinMessageBox(
const auto peer = item->history()->peer;
const auto msgId = item->id;
const auto topicRootId = item->topic() ? item->topicRootId() : MsgId();
const auto pinningOld = IsOldForPin(msgId, peer, topicRootId);
const auto monoforumPeerId = item->history()->peer->amMonoforumAdmin()
? item->sublistPeerId()
: PeerId();
const auto pinningOld = IsOldForPin(
msgId,
peer,
topicRootId,
monoforumPeerId);
const auto state = box->lifetime().make_state<State>();
const auto api = box->lifetime().make_state<MTP::Sender>(
&peer->session().mtp());