diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 0b9db29c9..8a3f24305 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -1073,6 +1073,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_sure_leave_group" = "Are you sure you want to leave this group?"; "lng_sure_delete_group" = "Are you sure, you want to delete this group? All members will be removed and all messages will be lost."; "lng_sure_delete_saved_messages" = "Are you sure, you want to delete all your saved messages?\n\nThis action cannot be undone."; +"lng_no_clear_history_channel" = "In channels you can enable auto-delete for messages."; +"lng_no_clear_history_group" = "In public groups you can enable auto-delete for messages."; "lng_message_empty" = "Empty Message"; "lng_message_unsupported" = "This message is not supported by your version of Telegram Desktop. Please update to the latest version in Settings, or install it from {link}"; diff --git a/Telegram/SourceFiles/boxes/confirm_box.cpp b/Telegram/SourceFiles/boxes/confirm_box.cpp index 5ae466802..5d5982b4a 100644 --- a/Telegram/SourceFiles/boxes/confirm_box.cpp +++ b/Telegram/SourceFiles/boxes/confirm_box.cpp @@ -583,9 +583,20 @@ void DeleteMessagesBox::prepare() { auto deleteText = lifetime().make_state>(); *deleteText = tr::lng_box_delete(); auto deleteStyle = &st::defaultBoxButton; + auto canDelete = true; if (const auto peer = _wipeHistoryPeer) { if (_wipeHistoryJustClear) { - details.text = peer->isSelf() + const auto isChannel = peer->isBroadcast(); + const auto isPublicGroup = peer->isMegagroup() + && peer->asChannel()->isPublic(); + if (isChannel || isPublicGroup) { + canDelete = false; + } + details.text = isChannel + ? tr::lng_no_clear_history_channel(tr::now) + : isPublicGroup + ? tr::lng_no_clear_history_group(tr::now) + : peer->isSelf() ? tr::lng_sure_delete_saved_messages(tr::now) : peer->isUser() ? tr::lng_sure_delete_history(tr::now, lt_contact, peer->name) @@ -671,11 +682,15 @@ void DeleteMessagesBox::prepare() { }); } - addButton( - deleteText->value(), - [=] { deleteAndClear(); }, - *deleteStyle); - addButton(tr::lng_cancel(), [=] { closeBox(); }); + if (canDelete) { + addButton( + deleteText->value(), + [=] { deleteAndClear(); }, + *deleteStyle); + addButton(tr::lng_cancel(), [=] { closeBox(); }); + } else { + addButton(tr::lng_about_done(), [=] { closeBox(); }); + } auto fullHeight = st::boxPadding.top() + _text->height() + st::boxPadding.bottom(); if (_moderateFrom) { diff --git a/Telegram/SourceFiles/window/window_peer_menu.cpp b/Telegram/SourceFiles/window/window_peer_menu.cpp index f9f1b70a9..84e8e173e 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.cpp +++ b/Telegram/SourceFiles/window/window_peer_menu.cpp @@ -582,7 +582,8 @@ void Filler::addChannelActions(not_null channel) { } } if (channel->amIn()) { - if (isGroup && !channel->isPublic()) { + if ((isGroup && !channel->isPublic()) + || channel->canDeleteMessages()) { _addAction( tr::lng_profile_clear_history(tr::now), ClearHistoryHandler(channel));