Remove debug-only ttl for messages.

This commit is contained in:
John Preston 2021-02-16 20:16:42 +04:00
parent 48821af475
commit 5f030bc0c8
4 changed files with 14 additions and 14 deletions

View File

@ -981,7 +981,6 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_manage_messages_ttl_after1" = "24 hours";
"lng_manage_messages_ttl_after2" = "7 days";
"lng_ttl_edit_title" = "Auto-delete messages in this chat";
"lng_ttl_edit_about" = "Automatically delete new messages after a certain period of time for you and {user}.";
"lng_ttl_edit_about_group" = "Automatically delete new messages sent in this chat after a certain period of time.";
"lng_ttl_edit_about_channel" = "Automatically delete new messages sent in this channel after a certain period of time.";

View File

@ -666,8 +666,10 @@ void DeleteMessagesBox::prepare() {
if (_wipeHistoryJustClear
&& _wipeHistoryPeer
&& (_wipeHistoryPeer->isUser()
|| _wipeHistoryPeer->isMegagroup()
|| _wipeHistoryPeer->isChat())) {
|| (_wipeHistoryPeer->isChat()
&& _wipeHistoryPeer->asChat()->canDeleteMessages())
|| (_wipeHistoryPeer->isChannel()
&& _wipeHistoryPeer->asChannel()->canDeleteMessages()))) {
_wipeHistoryPeer->updateFull();
_autoDeleteSettings.create(
this,

View File

@ -374,8 +374,8 @@ void HistoryService::setMessageByAction(const MTPmessageAction &action) {
auto prepareSetMessagesTTL = [this](const MTPDmessageActionSetMessagesTTL &action) {
auto result = PreparedText{};
const auto period = action.vperiod().v;
const auto duration = (period == 5) AssertIsDebug()
? u"5 seconds"_q AssertIsDebug()
const auto duration = (period == 5)
? u"5 seconds"_q
: (period < 3 * 86400)
? tr::lng_ttl_about_duration1(tr::now)
: tr::lng_ttl_about_duration2(tr::now);

View File

@ -190,7 +190,6 @@ void AutoDeleteSettingsBox(
rpl::producer<QString> about,
Fn<void(TimeId)> callback) {
box->setTitle(tr::lng_manage_messages_ttl_title());
box->setWidth(st::boxWideWidth);
struct State {
TimeId period = 0;
@ -202,25 +201,25 @@ void AutoDeleteSettingsBox(
const auto options = std::vector<QString>{
tr::lng_manage_messages_ttl_never(tr::now),
u"5 seconds"_q, AssertIsDebug()
//u"5 seconds"_q, AssertIsDebug()
tr::lng_manage_messages_ttl_after1(tr::now),
tr::lng_manage_messages_ttl_after2(tr::now),
};
const auto periodToIndex = [&](TimeId period) {
return !period
? 0
: (period == 5) AssertIsDebug()
? 1 AssertIsDebug()
//: (period == 5) AssertIsDebug()
//? 1 AssertIsDebug()
: (period < 3 * 86400)
? 2
: 3;
? 1
: 2;
};
const auto indexToPeriod = [&](int index) {
return !index
? 0
: (index == 1) AssertIsDebug()
? 5 AssertIsDebug()
: (index == 2)
//: (index == 1) AssertIsDebug()
//? 5 AssertIsDebug()
: (index == 1)
? 86400
: 7 * 86400;
};