2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-30 22:16:14 +00:00

Update API scheme on layer 206.

This commit is contained in:
John Preston
2025-06-16 15:02:30 +04:00
parent 0473374d51
commit 8dbc175c02
14 changed files with 132 additions and 61 deletions

View File

@@ -75,16 +75,12 @@ using RightsMap = std::vector<std::pair<ChatAdminRight, tr::phrase<>>>;
using Flag = ChatAdminRight;
return {
{ Flag::ChangeInfo, tr::lng_request_group_change_info },
{
Flag::DeleteMessages,
tr::lng_request_group_delete_messages },
{ Flag::DeleteMessages, tr::lng_request_group_delete_messages },
{ Flag::BanUsers, tr::lng_request_group_ban_users },
{ Flag::InviteByLinkOrAdd, tr::lng_request_group_invite },
{ Flag::PinMessages, tr::lng_request_group_pin_messages },
{ Flag::ManageTopics, tr::lng_request_group_manage_topics },
{
Flag::ManageCall,
tr::lng_request_group_manage_video_chats },
{ Flag::ManageCall, tr::lng_request_group_manage_video_chats },
{ Flag::Anonymous, tr::lng_request_group_anonymous },
{ Flag::AddAdmins, tr::lng_request_group_add_admins },
};
@@ -94,21 +90,12 @@ using RightsMap = std::vector<std::pair<ChatAdminRight, tr::phrase<>>>;
using Flag = ChatAdminRight;
return {
{ Flag::ChangeInfo, tr::lng_request_channel_change_info },
{
Flag::PostMessages,
tr::lng_request_channel_post_messages },
{
Flag::EditMessages,
tr::lng_request_channel_edit_messages },
{
Flag::DeleteMessages,
tr::lng_request_channel_delete_messages },
{
Flag::InviteByLinkOrAdd,
tr::lng_request_channel_add_subscribers },
{
Flag::ManageCall,
tr::lng_request_channel_manage_livestreams },
{ Flag::PostMessages, tr::lng_request_channel_post_messages },
{ Flag::EditMessages, tr::lng_request_channel_edit_messages },
{ Flag::DeleteMessages, tr::lng_request_channel_delete_messages },
{ Flag::InviteByLinkOrAdd, tr::lng_request_channel_add_subscribers },
{ Flag::ManageCall, tr::lng_request_channel_manage_livestreams },
{ Flag::ManageDirect, tr::lng_request_channel_manage_direct },
{ Flag::AddAdmins, tr::lng_request_channel_add_admins },
};
}

View File

@@ -245,7 +245,8 @@ ChatAdminRightsInfo EditAdminBox::defaultRights() const {
| Flag::EditStories
| Flag::DeleteStories
| Flag::InviteByLinkOrAdd
| Flag::ManageCall) };
| Flag::ManageCall
| Flag::ManageDirect) };
}
void EditAdminBox::prepare() {

View File

@@ -152,8 +152,7 @@ void SaveChannelAdmin(
channel->session().api().request(MTPchannels_EditAdmin(
channel->inputChannel,
user->inputUser,
MTP_chatAdminRights(MTP_flags(
MTPDchatAdminRights::Flags::from_raw(uint32(newRights.flags)))),
AdminRightsToMTP(newRights),
MTP_string(rank)
)).done([=](const MTPUpdates &result) {
channel->session().api().applyUpdates(result);

View File

@@ -183,10 +183,7 @@ void SaveDefaultRestrictions(
const auto requestId = api->request(
MTPmessages_EditChatDefaultBannedRights(
peer->input,
MTP_chatBannedRights(
MTP_flags(
MTPDchatBannedRights::Flags::from_raw(uint32(rights))),
MTP_int(0)))
RestrictionsToMTP({ rights, 0 }))
).done([=](const MTPUpdates &result) {
api->clearModifyRequest(key);
api->applyUpdates(result);

View File

@@ -164,11 +164,15 @@ constexpr auto kDefaultChargeStars = 10;
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) },
{
Flag::DeleteStories,
tr::lng_rights_channel_delete_stories(tr::now),
},
};
auto second = std::vector<AdminRightLabel>{
{ Flag::InviteByLinkOrAdd, tr::lng_rights_group_invite(tr::now) },
{ Flag::ManageCall, tr::lng_rights_channel_manage_calls(tr::now) },
{ Flag::ManageDirect, tr::lng_rights_channel_manage_direct(tr::now) },
{ Flag::AddAdmins, tr::lng_rights_add_admins(tr::now) },
};
return {