2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 14:38:15 +00:00

Allow editing group wallpaper / status / emoji set.

This commit is contained in:
John Preston
2024-02-08 21:58:16 +04:00
parent 680171226c
commit 08efa73b2b
14 changed files with 308 additions and 110 deletions

View File

@@ -1163,20 +1163,34 @@ void ApplyChannelUpdate(
channel->owner().botCommandsChanged(channel);
}
const auto stickerSet = update.vstickerset();
const auto set = stickerSet ? &stickerSet->c_stickerSet() : nullptr;
const auto newSetId = (set ? set->vid().v : 0);
const auto oldSetId = channel->mgInfo->stickerSet.id;
const auto sset = stickerSet ? &stickerSet->c_stickerSet() : nullptr;
const auto newStickerSetId = (sset ? sset->vid().v : 0);
const auto oldStickerSetId = channel->mgInfo->stickerSet.id;
const auto stickersChanged = (canEditStickers != channel->canEditStickers())
|| (oldSetId != newSetId);
if (oldSetId != newSetId) {
|| (oldStickerSetId != newStickerSetId);
if (oldStickerSetId != newStickerSetId) {
channel->mgInfo->stickerSet = StickerSetIdentifier{
.id = set ? set->vid().v : 0,
.accessHash = set ? set->vaccess_hash().v : 0,
.id = sset ? sset->vid().v : 0,
.accessHash = sset ? sset->vaccess_hash().v : 0,
};
}
if (stickersChanged) {
session->changes().peerUpdated(channel, UpdateFlag::StickersSet);
}
const auto emojiSet = update.vemojiset();
const auto eset = emojiSet ? &emojiSet->c_stickerSet() : nullptr;
const auto newEmojiSetId = (eset ? eset->vid().v : 0);
const auto oldEmojiSetId = channel->mgInfo->emojiSet.id;
const auto emojiChanged = (oldEmojiSetId != newEmojiSetId);
if (oldEmojiSetId != newEmojiSetId) {
channel->mgInfo->emojiSet = StickerSetIdentifier{
.id = eset ? eset->vid().v : 0,
.accessHash = eset ? eset->vaccess_hash().v : 0,
};
}
if (emojiChanged) {
session->changes().peerUpdated(channel, UpdateFlag::EmojiSet);
}
channel->setBoostsUnrestrict(
update.vboosts_applied().value_or_empty(),
update.vboosts_unrestrict().value_or_empty());