diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 099c686f0..c2c5c9c88 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -921,6 +921,10 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_cant_invite_banned" = "Sorry, only admin can add this user."; "lng_cant_invite_privacy" = "Sorry, you cannot add this user to groups because of their privacy settings."; "lng_cant_invite_privacy_channel" = "Sorry, you cannot add this user to channels because of their privacy settings."; +"lng_cant_delete_group#one" = "Sorry, it is currently not possible to manually delete communities that have more than {count} member. Please contact Telegram support if you would like to delete this group."; +"lng_cant_delete_group#other" = "Sorry, it is currently not possible to manually delete communities that have more than {count} members. Please contact Telegram support if you would like to delete this group."; +"lng_cant_delete_channel#one" = "Sorry, it is currently not possible to manually delete communities that have more than {count} member. Please contact Telegram support if you would like to delete this channel."; +"lng_cant_delete_channel#other" = "Sorry, it is currently not possible to manually delete communities that have more than {count} members. Please contact Telegram support if you would like to delete this channel."; "lng_cant_do_this" = "Sorry, this action is unavailable."; "lng_send_button" = "Send"; diff --git a/Telegram/SourceFiles/profile/profile_block_actions.cpp b/Telegram/SourceFiles/profile/profile_block_actions.cpp index 3a3de93d7..29acc129b 100644 --- a/Telegram/SourceFiles/profile/profile_block_actions.cpp +++ b/Telegram/SourceFiles/profile/profile_block_actions.cpp @@ -35,6 +35,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org namespace Profile { constexpr auto kEnableSearchMembersAfterCount = 50; +constexpr auto kMaxChannelMembersDeleteAllowed = 1000; using UpdateFlag = Notify::PeerUpdate::Flag; @@ -330,6 +331,13 @@ void ActionsWidget::onUpgradeToSupergroup() { } void ActionsWidget::onDeleteChannel() { + if (auto channel = peer()->asChannel()) { + if (channel->membersCount() > kMaxChannelMembersDeleteAllowed) { + Ui::show(Box((channel->isMegagroup() ? lng_cant_delete_group : lng_cant_delete_channel)(lt_count, kMaxChannelMembersDeleteAllowed))); + return; + } + } + auto text = lang(peer()->isMegagroup() ? lng_sure_delete_group : lng_sure_delete_channel); Ui::show(Box(text, lang(lng_box_delete), st::attentionBoxButton, base::lambda_guarded(this, [this] { Ui::hideLayer();