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_after1" = "24 hours";
"lng_manage_messages_ttl_after2" = "7 days"; "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" = "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_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."; "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 if (_wipeHistoryJustClear
&& _wipeHistoryPeer && _wipeHistoryPeer
&& (_wipeHistoryPeer->isUser() && (_wipeHistoryPeer->isUser()
|| _wipeHistoryPeer->isMegagroup() || (_wipeHistoryPeer->isChat()
|| _wipeHistoryPeer->isChat())) { && _wipeHistoryPeer->asChat()->canDeleteMessages())
|| (_wipeHistoryPeer->isChannel()
&& _wipeHistoryPeer->asChannel()->canDeleteMessages()))) {
_wipeHistoryPeer->updateFull(); _wipeHistoryPeer->updateFull();
_autoDeleteSettings.create( _autoDeleteSettings.create(
this, this,

View file

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

View file

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