diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index cd86ebea0..5c2e81430 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -691,6 +691,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_settings_ttl_select_chats_title" = "Select Chats"; "lng_settings_ttl_select_chats_subtitle" = "to apply the self-destruct timer"; "lng_settings_ttl_select_chats_subtitle_chosen" = "will have the self-destruct timer"; +"lng_settings_ttl_select_chats_sorry" = "Sorry, you can't set self-destruct timer for this chat."; "lng_settings_ttl_select_chats_status" = "auto-delete after {after_duration}"; "lng_settings_ttl_select_chats_status_disabled" = "auto-deletion disabled"; "lng_settings_ttl_select_chats_toast#one" = "Self-destruct timer for {duration} has been enabled in {count} selected chat."; diff --git a/Telegram/SourceFiles/settings/settings_global_ttl.cpp b/Telegram/SourceFiles/settings/settings_global_ttl.cpp index fa9235bce..435bc00f3 100644 --- a/Telegram/SourceFiles/settings/settings_global_ttl.cpp +++ b/Telegram/SourceFiles/settings/settings_global_ttl.cpp @@ -11,6 +11,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include "apiwrap.h" #include "boxes/peer_list_controllers.h" #include "data/data_changes.h" +#include "data/data_chat.h" #include "data/data_peer.h" #include "data/data_session.h" #include "history/history.h" @@ -117,6 +118,13 @@ void TTLChatsBoxController::prepareViewHook() { } void TTLChatsBoxController::rowClicked(not_null row) { + if (!TTLMenu::TTLValidator(nullptr, row->peer()).can()) { + Ui::ShowMultilineToast({ + .parentOverride = delegate()->peerListToastParent(), + .text = { tr::lng_settings_ttl_select_chats_sorry(tr::now) }, + }); + return; + } delegate()->peerListSetRowChecked(row, !row->checked()); } @@ -124,6 +132,8 @@ std::unique_ptr TTLChatsBoxController::createRow( not_null history) { if (history->peer->isSelf() || history->peer->isRepliesChat()) { return nullptr; + } else if (history->peer->isChat() && history->peer->asChat()->amIn()) { + } else if (history->peer->isMegagroup()) { } else if (!TTLMenu::TTLValidator(nullptr, history->peer).can()) { return nullptr; }