diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 8312074ad..d1ac8a25c 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -3682,6 +3682,11 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_admin_log_change_profile_background_emoji" = "{from} changed channel profile background emoji from {previous} to {emoji}"; "lng_admin_log_removed_profile_background_emoji" = "{from} removed channel profile background emoji {emoji}"; "lng_admin_log_change_wallpaper" = "{from} changed channel wallpaper"; +"lng_admin_log_set_status" = "{from} set channel emoji status to {emoji}"; +"lng_admin_log_change_status" = "{from} changed channel emoji status from {previous} to {emoji}"; +"lng_admin_log_removed_status" = "{from} removed channel emoji status {emoji}"; +"lng_admin_log_set_status_until" = "{from} set channel emoji status to {emoji} until {date}"; +"lng_admin_log_change_status_until" = "{from} changed channel emoji status from {previous} to {emoji} until {date}"; "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}"; diff --git a/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp b/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp index 78187be76..6f4f61be5 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp @@ -1910,7 +1910,80 @@ void GenerateItems( }; const auto createChangeEmojiStatus = [&](const LogChangeEmojiStatus &data) { + const auto parse = [](const MTPEmojiStatus &status) { + return status.match([]( + const MTPDemojiStatus &data) { + return data.vdocument_id().v; + }, [](const MTPDemojiStatusEmpty &) { + return DocumentId(); + }, [](const MTPDemojiStatusUntil &data) { + return data.vdocument_id().v; + }); + }; + const auto prevEmoji = parse(data.vprev_value()); + const auto nextEmoji = parse(data.vnew_value()); + const auto nextUntil = data.vnew_value().match([]( + const MTPDemojiStatusUntil &data) { + return data.vuntil().v; + }, [](const auto &) { return TimeId(); }); + const auto text = !prevEmoji + ? (nextUntil + ? tr::lng_admin_log_set_status_until( + tr::now, + lt_from, + fromLinkText, + lt_emoji, + Ui::Text::SingleCustomEmoji( + Data::SerializeCustomEmojiId(nextEmoji)), + lt_date, + TextWithEntities{ + langDateTime(base::unixtime::parse(nextUntil)) }, + Ui::Text::WithEntities) + : tr::lng_admin_log_set_status( + tr::now, + lt_from, + fromLinkText, + lt_emoji, + Ui::Text::SingleCustomEmoji( + Data::SerializeCustomEmojiId(nextEmoji)), + Ui::Text::WithEntities)) + : !nextEmoji + ? tr::lng_admin_log_removed_status( + tr::now, + lt_from, + fromLinkText, + lt_emoji, + Ui::Text::SingleCustomEmoji( + Data::SerializeCustomEmojiId(prevEmoji)), + Ui::Text::WithEntities) + : (nextUntil + ? tr::lng_admin_log_change_status_until( + tr::now, + lt_from, + fromLinkText, + lt_previous, + Ui::Text::SingleCustomEmoji( + Data::SerializeCustomEmojiId(prevEmoji)), + lt_emoji, + Ui::Text::SingleCustomEmoji( + Data::SerializeCustomEmojiId(nextEmoji)), + lt_date, + TextWithEntities{ + langDateTime(base::unixtime::parse(nextUntil)) }, + Ui::Text::WithEntities) + : tr::lng_admin_log_change_status( + tr::now, + lt_from, + fromLinkText, + lt_previous, + Ui::Text::SingleCustomEmoji( + Data::SerializeCustomEmojiId(prevEmoji)), + lt_emoji, + Ui::Text::SingleCustomEmoji( + Data::SerializeCustomEmojiId(nextEmoji)), + Ui::Text::WithEntities)); + addSimpleServiceMessage(text); }; action.match(