Improve color/emoji admin log events.

This commit is contained in:
John Preston 2023-10-28 22:27:30 +04:00
parent d47b99b0b5
commit c8660b5385
2 changed files with 39 additions and 7 deletions

View File

@ -3519,8 +3519,10 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
"lng_admin_log_participant_volume_channel" = "{from} changed live stream volume for {user} to {percent}";
"lng_admin_log_antispam_enabled" = "{from} enabled aggressive anti-spam";
"lng_admin_log_antispam_disabled" = "{from} disabled aggressive anti-spam";
"lng_admin_log_change_color" = "{from} changed color";
"lng_admin_log_change_background_emoji" = "{from} changed background emoji";
"lng_admin_log_change_color" = "{from} changed channel color from {previous} to {color}";
"lng_admin_log_set_background_emoji" = "{from} set channel background emoji to {emoji}";
"lng_admin_log_change_background_emoji" = "{from} changed channel background emoji from {previous} to {emoji}";
"lng_admin_log_removed_background_emoji" = "{from} removed channel background emoji {emoji}";
"lng_admin_log_user_with_username" = "{name} ({mention})";
"lng_admin_log_messages_ttl_set" = "{from} enabled messages auto-delete after {duration}";
"lng_admin_log_messages_ttl_changed" = "{from} changed messages auto-delete period from {previous} to {duration}";

View File

@ -1822,16 +1822,46 @@ void GenerateItems(
tr::now,
lt_from,
fromLinkText,
lt_previous,
{ '#' + QString::number(data.vprev_value().v + 1) },
lt_color,
{ '#' + QString::number(data.vnew_value().v + 1) },
Ui::Text::WithEntities);
addSimpleServiceMessage(text);
};
const auto createChangeBackgroundEmoji = [&](const LogChangeBackgroundEmoji &data) {
const auto text = tr::lng_admin_log_change_background_emoji(
tr::now,
lt_from,
fromLinkText,
Ui::Text::WithEntities);
const auto was = data.vprev_value().v;
const auto now = data.vnew_value().v;
const auto text = !was
? tr::lng_admin_log_set_background_emoji(
tr::now,
lt_from,
fromLinkText,
lt_emoji,
Ui::Text::SingleCustomEmoji(
Data::SerializeCustomEmojiId(now)),
Ui::Text::WithEntities)
: !now
? tr::lng_admin_log_removed_background_emoji(
tr::now,
lt_from,
fromLinkText,
lt_emoji,
Ui::Text::SingleCustomEmoji(
Data::SerializeCustomEmojiId(was)),
Ui::Text::WithEntities)
: tr::lng_admin_log_change_background_emoji(
tr::now,
lt_from,
fromLinkText,
lt_previous,
Ui::Text::SingleCustomEmoji(
Data::SerializeCustomEmojiId(was)),
lt_emoji,
Ui::Text::SingleCustomEmoji(
Data::SerializeCustomEmojiId(now)),
Ui::Text::WithEntities);
addSimpleServiceMessage(text);
};