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

Support paid_media_allowed flag in ChannelFull.

This commit is contained in:
John Preston
2024-06-28 10:14:23 +04:00
parent 09e6077e97
commit 77d214d2a5
6 changed files with 28 additions and 5 deletions

View File

@@ -583,6 +583,10 @@ bool ChannelData::canDeleteStories() const {
|| (adminRights() & AdminRight::DeleteStories);
}
bool ChannelData::canPostPaidMedia() const {
return canPostMessages() && (flags() & Flag::PaidMediaAllowed);
}
bool ChannelData::anyoneCanAddMembers() const {
return !(defaultRestrictions() & Restriction::AddParticipants);
}
@@ -1084,7 +1088,8 @@ void ApplyChannelUpdate(
| Flag::ParticipantsHidden
| Flag::CanGetStatistics
| Flag::ViewAsMessages
| Flag::CanViewRevenue;
| Flag::CanViewRevenue
| Flag::PaidMediaAllowed;
channel->setFlags((channel->flags() & ~mask)
| (update.is_can_set_username() ? Flag::CanSetUsername : Flag())
| (update.is_can_view_participants()
@@ -1101,6 +1106,7 @@ void ApplyChannelUpdate(
| (update.is_view_forum_as_messages()
? Flag::ViewAsMessages
: Flag())
| (update.is_paid_media_allowed() ? Flag::PaidMediaAllowed : Flag())
| (update.is_can_view_revenue() ? Flag::CanViewRevenue : Flag()));
channel->setUserpicPhoto(update.vchat_photo());
if (const auto migratedFrom = update.vmigrated_from_chat_id()) {

View File

@@ -66,6 +66,7 @@ enum class ChannelDataFlag : uint64 {
ViewAsMessages = (1ULL << 30),
SimilarExpanded = (1ULL << 31),
CanViewRevenue = (1ULL << 32),
PaidMediaAllowed = (1ULL << 33),
};
inline constexpr bool is_flag_type(ChannelDataFlag) { return true; };
using ChannelDataFlags = base::flags<ChannelDataFlag>;
@@ -357,6 +358,7 @@ public:
[[nodiscard]] bool canPostStories() const;
[[nodiscard]] bool canEditStories() const;
[[nodiscard]] bool canDeleteStories() const;
[[nodiscard]] bool canPostPaidMedia() const;
[[nodiscard]] bool hiddenPreHistory() const;
[[nodiscard]] bool canViewMembers() const;
[[nodiscard]] bool canViewAdmins() const;