Filtered out only channels in list of applying TTL for multiple chats.

This commit is contained in:
23rd 2022-12-07 00:41:00 +03:00 committed by John Preston
parent bba45293da
commit 993b501996
2 changed files with 11 additions and 0 deletions

View File

@ -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.";

View File

@ -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<PeerListRow*> 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::Row> TTLChatsBoxController::createRow(
not_null<History*> 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;
}