From 5f83bb63e679296191c214c4082a14407bc3d525 Mon Sep 17 00:00:00 2001 From: RadRussianRus Date: Thu, 2 Jul 2020 11:05:17 +0300 Subject: [PATCH] Do not combine permission setting Taken from TDesktop-x64/tdesktop. --- Telegram/Resources/langs/lang.strings | 10 ++++++++++ Telegram/Resources/langs/rewrites/ru.json | 10 +++++++++- .../boxes/peers/edit_peer_permissions_box.cpp | 9 ++++++++- Telegram/SourceFiles/data/data_peer.cpp | 8 ++++---- .../history/admin_log/history_admin_log_item.cpp | 5 ++++- 5 files changed, 35 insertions(+), 7 deletions(-) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index b15eba5dc..a2e14e142 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -2566,4 +2566,14 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "ktg_profile_gif#other" = "{count} GIFs"; "ktg_media_gif_empty" = "No GIFs here yet"; +"ktg_rights_chat_send_stickers" = "Send stickers"; +"ktg_rights_chat_send_gif" = "Send GIFs"; +"ktg_rights_chat_send_games" = "Send games"; +"ktg_rights_chat_use_inline" = "Use inline bots"; + +"ktg_admin_log_banned_send_stickers" = "Send stickers"; +"ktg_admin_log_banned_send_gif" = "Send GIFs"; +"ktg_admin_log_banned_send_games" = "Send games"; +"ktg_admin_log_banned_use_inline" = "Use inline bots"; + // Keys finished diff --git a/Telegram/Resources/langs/rewrites/ru.json b/Telegram/Resources/langs/rewrites/ru.json index a759a4637..008d0b3ee 100644 --- a/Telegram/Resources/langs/rewrites/ru.json +++ b/Telegram/Resources/langs/rewrites/ru.json @@ -163,5 +163,13 @@ "many": "{count} GIF", "other": "{count} GIF" }, - "ktg_media_gif_empty": "Здесь пока нет GIF" + "ktg_media_gif_empty": "Здесь пока нет GIF", + "ktg_rights_chat_send_stickers": "Отправка стикеров", + "ktg_rights_chat_send_gif": "Отправка GIF", + "ktg_rights_chat_send_games": "Отправка игр", + "ktg_rights_chat_use_inline": "Отправка через ботов", + "ktg_admin_log_banned_send_stickers": "Отправка стикеров", + "ktg_admin_log_banned_send_gif": "Отправка GIF", + "ktg_admin_log_banned_send_games": "Отправка игр", + "ktg_admin_log_banned_use_inline": "Отправка через ботов" } diff --git a/Telegram/SourceFiles/boxes/peers/edit_peer_permissions_box.cpp b/Telegram/SourceFiles/boxes/peers/edit_peer_permissions_box.cpp index 91c7431b6..2054147f3 100644 --- a/Telegram/SourceFiles/boxes/peers/edit_peer_permissions_box.cpp +++ b/Telegram/SourceFiles/boxes/peers/edit_peer_permissions_box.cpp @@ -104,7 +104,10 @@ std::vector> RestrictionLabels() { const auto langKeys = { tr::lng_rights_chat_send_text, tr::lng_rights_chat_send_media, - tr::lng_rights_chat_send_stickers, + tr::ktg_rights_chat_send_stickers, + tr::ktg_rights_chat_send_gif, + tr::ktg_rights_chat_send_games, + tr::ktg_rights_chat_use_inline, tr::lng_rights_chat_send_links, tr::lng_rights_chat_send_polls, tr::lng_rights_chat_add_members, @@ -154,6 +157,7 @@ auto Dependencies(ChatRestrictions) using Flag = ChatRestriction; return { + /* // stickers <-> gifs { Flag::f_send_gifs, Flag::f_send_stickers }, { Flag::f_send_stickers, Flag::f_send_gifs }, @@ -168,6 +172,7 @@ auto Dependencies(ChatRestrictions) // stickers -> send_media { Flag::f_send_stickers, Flag::f_send_messages }, + */ // embed_links -> send_media { Flag::f_embed_links, Flag::f_send_messages }, @@ -276,11 +281,13 @@ ChatRestrictions FixDependentRestrictions(ChatRestrictions restrictions) { // Fix iOS bug of saving send_inline like embed_links. // We copy send_stickers to send_inline. + /* if (restrictions & ChatRestriction::f_send_stickers) { restrictions |= ChatRestriction::f_send_inline; } else { restrictions &= ~ChatRestriction::f_send_inline; } + */ // Apply the strictest. const auto fixOne = [&] { diff --git a/Telegram/SourceFiles/data/data_peer.cpp b/Telegram/SourceFiles/data/data_peer.cpp index 54c27e987..71deff532 100644 --- a/Telegram/SourceFiles/data/data_peer.cpp +++ b/Telegram/SourceFiles/data/data_peer.cpp @@ -855,10 +855,10 @@ std::vector ListOfRestrictions() { return { Flag::f_send_messages, Flag::f_send_media, - Flag::f_send_stickers - | Flag::f_send_gifs - | Flag::f_send_games - | Flag::f_send_inline, + Flag::f_send_stickers, + Flag::f_send_gifs, + Flag::f_send_games, + Flag::f_send_inline, Flag::f_embed_links, Flag::f_send_polls, Flag::f_invite_users, diff --git a/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp b/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp index e3939d03c..3dd8387b5 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp @@ -198,7 +198,10 @@ QString GenerateBannedChangeText( { Flag::f_view_messages, tr::lng_admin_log_banned_view_messages }, { Flag::f_send_messages, tr::lng_admin_log_banned_send_messages }, { Flag::f_send_media, tr::lng_admin_log_banned_send_media }, - { Flag::f_send_stickers | Flag::f_send_gifs | Flag::f_send_inline | Flag::f_send_games, tr::lng_admin_log_banned_send_stickers }, + { Flag::f_send_stickers, tr::ktg_admin_log_banned_send_stickers }, + { Flag::f_send_gifs, tr::ktg_admin_log_banned_send_gif }, + { Flag::f_send_games, tr::ktg_admin_log_banned_send_games }, + { Flag::f_send_inline, tr::ktg_admin_log_banned_use_inline }, { Flag::f_embed_links, tr::lng_admin_log_banned_embed_links }, { Flag::f_send_polls, tr::lng_admin_log_banned_send_polls }, { Flag::f_change_info, tr::lng_admin_log_admin_change_info },