mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Add stories rights to group admins edit.
This commit is contained in:
parent
fc6f2520b7
commit
964846f1bb
3 changed files with 17 additions and 14 deletions
|
@ -104,7 +104,7 @@ constexpr auto kForceDisableTooltipDuration = 3 * crl::time(1000);
|
||||||
using Flag = ChatAdminRight;
|
using Flag = ChatAdminRight;
|
||||||
|
|
||||||
if (options.isGroup) {
|
if (options.isGroup) {
|
||||||
auto result = std::vector<AdminRightLabel>{
|
auto first = std::vector<AdminRightLabel>{
|
||||||
{ Flag::ChangeInfo, tr::lng_rights_group_info(tr::now) },
|
{ Flag::ChangeInfo, tr::lng_rights_group_info(tr::now) },
|
||||||
{ Flag::DeleteMessages, tr::lng_rights_group_delete(tr::now) },
|
{ Flag::DeleteMessages, tr::lng_rights_group_delete(tr::now) },
|
||||||
{ Flag::BanUsers, tr::lng_rights_group_ban(tr::now) },
|
{ Flag::BanUsers, tr::lng_rights_group_ban(tr::now) },
|
||||||
|
@ -113,19 +113,30 @@ constexpr auto kForceDisableTooltipDuration = 3 * crl::time(1000);
|
||||||
: tr::lng_rights_group_invite(tr::now) },
|
: tr::lng_rights_group_invite(tr::now) },
|
||||||
{ Flag::ManageTopics, tr::lng_rights_group_topics(tr::now) },
|
{ Flag::ManageTopics, tr::lng_rights_group_topics(tr::now) },
|
||||||
{ Flag::PinMessages, tr::lng_rights_group_pin(tr::now) },
|
{ Flag::PinMessages, tr::lng_rights_group_pin(tr::now) },
|
||||||
|
};
|
||||||
|
auto stories = std::vector<AdminRightLabel>{
|
||||||
|
{ Flag::PostStories, tr::lng_rights_channel_post_stories(tr::now) },
|
||||||
|
{ Flag::EditStories, tr::lng_rights_channel_edit_stories(tr::now) },
|
||||||
|
{ Flag::DeleteStories, tr::lng_rights_channel_delete_stories(tr::now) },
|
||||||
|
};
|
||||||
|
auto second = std::vector<AdminRightLabel>{
|
||||||
{ Flag::ManageCall, tr::lng_rights_group_manage_calls(tr::now) },
|
{ Flag::ManageCall, tr::lng_rights_group_manage_calls(tr::now) },
|
||||||
{ Flag::Anonymous, tr::lng_rights_group_anonymous(tr::now) },
|
{ Flag::Anonymous, tr::lng_rights_group_anonymous(tr::now) },
|
||||||
{ Flag::AddAdmins, tr::lng_rights_add_admins(tr::now) },
|
{ Flag::AddAdmins, tr::lng_rights_add_admins(tr::now) },
|
||||||
};
|
};
|
||||||
if (!options.isForum) {
|
if (!options.isForum) {
|
||||||
result.erase(
|
first.erase(
|
||||||
ranges::remove(
|
ranges::remove(
|
||||||
result,
|
first,
|
||||||
Flag::ManageTopics | Flag(),
|
Flag::ManageTopics | Flag(),
|
||||||
&AdminRightLabel::flags),
|
&AdminRightLabel::flags),
|
||||||
end(result));
|
end(first));
|
||||||
}
|
}
|
||||||
return { { std::nullopt, std::move(result) } };
|
return {
|
||||||
|
{ std::nullopt, std::move(first) },
|
||||||
|
{ tr::lng_rights_channel_manage_stories(), std::move(stories) },
|
||||||
|
{ std::nullopt, std::move(second) },
|
||||||
|
};
|
||||||
}
|
}
|
||||||
auto first = std::vector<AdminRightLabel>{
|
auto first = std::vector<AdminRightLabel>{
|
||||||
{ Flag::ChangeInfo, tr::lng_rights_channel_info(tr::now) },
|
{ Flag::ChangeInfo, tr::lng_rights_channel_info(tr::now) },
|
||||||
|
|
|
@ -556,25 +556,16 @@ bool ChannelData::canDeleteMessages() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChannelData::canPostStories() const {
|
bool ChannelData::canPostStories() const {
|
||||||
if (!isBroadcast()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return amCreator()
|
return amCreator()
|
||||||
|| (adminRights() & AdminRight::PostStories);
|
|| (adminRights() & AdminRight::PostStories);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChannelData::canEditStories() const {
|
bool ChannelData::canEditStories() const {
|
||||||
if (!isBroadcast()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return amCreator()
|
return amCreator()
|
||||||
|| (adminRights() & AdminRight::EditStories);
|
|| (adminRights() & AdminRight::EditStories);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ChannelData::canDeleteStories() const {
|
bool ChannelData::canDeleteStories() const {
|
||||||
if (!isBroadcast()) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return amCreator()
|
return amCreator()
|
||||||
|| (adminRights() & AdminRight::DeleteStories);
|
|| (adminRights() & AdminRight::DeleteStories);
|
||||||
}
|
}
|
||||||
|
|
|
@ -355,6 +355,7 @@ HistoryInner::HistoryInner(
|
||||||
_theme = std::move(theme);
|
_theme = std::move(theme);
|
||||||
controller->setChatStyleTheme(_theme);
|
controller->setChatStyleTheme(_theme);
|
||||||
}, lifetime());
|
}, lifetime());
|
||||||
|
Assert(_theme != nullptr);
|
||||||
|
|
||||||
setAttribute(Qt::WA_AcceptTouchEvents);
|
setAttribute(Qt::WA_AcceptTouchEvents);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue