Fixed phrase of global TTL for new chats.

This commit is contained in:
23rd 2023-01-07 05:09:10 +03:00 committed by John Preston
parent 0e3eddcb77
commit 9b7689993f
2 changed files with 11 additions and 6 deletions

View File

@ -1529,6 +1529,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_action_ttl_changed_you" = "You set messages to auto-delete in {duration}";
"lng_action_ttl_changed_channel" = "New messages will auto-delete in {duration}";
"lng_action_ttl_global" = "{from} uses a self-destruct timer for all chats. All new messages in this chat will be automatically deleted after {duration} they've been sent.";
"lng_action_ttl_global_me" = "You set a self-destruct timer for all chats. All new messages in this chat will be automatically deleted after {duration} theyve been sent.";
"lng_action_ttl_removed" = "{from} has set messages not to auto-delete";
"lng_action_ttl_removed_you" = "You disabled the auto-delete timer";
"lng_action_ttl_removed_channel" = "New messages will not auto-delete";

View File

@ -3676,18 +3676,22 @@ void HistoryItem::setServiceMessageByAction(const MTPmessageAction &action) {
const auto duration = (period == 5)
? u"5 seconds"_q
: Ui::FormatTTL(period);
if (const auto from = action.vauto_setting_from()) {
if (const auto from = action.vauto_setting_from(); from && period) {
if (const auto peer = _from->owner().peer(peerFromUser(*from))) {
if (!peer->isSelf() && period) {
result.text = tr::lng_action_ttl_global(
result.text = (peer->id == peer->session().userPeerId())
? tr::lng_action_ttl_global_me(
tr::now,
lt_duration,
{ .text = duration },
Ui::Text::WithEntities)
: tr::lng_action_ttl_global(
tr::now,
lt_from,
fromLinkText(), // Link 1.
Ui::Text::Link(peer->name(), 1), // Link 1.
lt_duration,
{ .text = duration },
Ui::Text::WithEntities);
return result;
}
return result;
}
}
if (isPost()) {