Added support of permission to manage channel earn.

This commit is contained in:
23rd 2024-03-27 21:31:20 +03:00 committed by John Preston
parent a1264a6088
commit c66b5b2490
2 changed files with 38 additions and 35 deletions

View File

@ -1070,7 +1070,8 @@ void ApplyChannelUpdate(
| Flag::Location
| Flag::ParticipantsHidden
| Flag::CanGetStatistics
| Flag::ViewAsMessages;
| Flag::ViewAsMessages
| Flag::CanViewRevenue;
channel->setFlags((channel->flags() & ~mask)
| (update.is_can_set_username() ? Flag::CanSetUsername : Flag())
| (update.is_can_view_participants()
@ -1086,7 +1087,8 @@ void ApplyChannelUpdate(
| (update.is_can_view_stats() ? Flag::CanGetStatistics : Flag())
| (update.is_view_forum_as_messages()
? Flag::ViewAsMessages
: Flag()));
: Flag())
| (update.is_can_view_revenue() ? Flag::CanViewRevenue : Flag()));
channel->setUserpicPhoto(update.vchat_photo());
if (const auto migratedFrom = update.vmigrated_from_chat_id()) {
channel->addFlags(Flag::Megagroup);

View File

@ -32,39 +32,40 @@ struct ChannelLocation {
}
};
enum class ChannelDataFlag {
Left = (1 << 0),
Creator = (1 << 1),
Forbidden = (1 << 2),
CallActive = (1 << 3),
CallNotEmpty = (1 << 4),
Signatures = (1 << 5),
Verified = (1 << 6),
Scam = (1 << 7),
Fake = (1 << 8),
Megagroup = (1 << 9),
Broadcast = (1 << 10),
Gigagroup = (1 << 11),
Username = (1 << 12),
Location = (1 << 13),
CanSetUsername = (1 << 14),
CanSetStickers = (1 << 15),
PreHistoryHidden = (1 << 16),
CanViewParticipants = (1 << 17),
HasLink = (1 << 18),
SlowmodeEnabled = (1 << 19),
NoForwards = (1 << 20),
JoinToWrite = (1 << 21),
RequestToJoin = (1 << 22),
Forum = (1 << 23),
AntiSpam = (1 << 24),
ParticipantsHidden = (1 << 25),
StoriesHidden = (1 << 26),
HasActiveStories = (1 << 27),
HasUnreadStories = (1 << 28),
CanGetStatistics = (1 << 29),
ViewAsMessages = (1 << 30),
SimilarExpanded = (1 << 31),
enum class ChannelDataFlag : uint64 {
Left = (1ULL << 0),
Creator = (1ULL << 1),
Forbidden = (1ULL << 2),
CallActive = (1ULL << 3),
CallNotEmpty = (1ULL << 4),
Signatures = (1ULL << 5),
Verified = (1ULL << 6),
Scam = (1ULL << 7),
Fake = (1ULL << 8),
Megagroup = (1ULL << 9),
Broadcast = (1ULL << 10),
Gigagroup = (1ULL << 11),
Username = (1ULL << 12),
Location = (1ULL << 13),
CanSetUsername = (1ULL << 14),
CanSetStickers = (1ULL << 15),
PreHistoryHidden = (1ULL << 16),
CanViewParticipants = (1ULL << 17),
HasLink = (1ULL << 18),
SlowmodeEnabled = (1ULL << 19),
NoForwards = (1ULL << 20),
JoinToWrite = (1ULL << 21),
RequestToJoin = (1ULL << 22),
Forum = (1ULL << 23),
AntiSpam = (1ULL << 24),
ParticipantsHidden = (1ULL << 25),
StoriesHidden = (1ULL << 26),
HasActiveStories = (1ULL << 27),
HasUnreadStories = (1ULL << 28),
CanGetStatistics = (1ULL << 29),
ViewAsMessages = (1ULL << 30),
SimilarExpanded = (1ULL << 31),
CanViewRevenue = (1ULL << 32),
};
inline constexpr bool is_flag_type(ChannelDataFlag) { return true; };
using ChannelDataFlags = base::flags<ChannelDataFlag>;