From 84aaec30a162b401a4f58b33e0777f906e19884c Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 24 Jun 2019 15:08:19 +0200 Subject: [PATCH] Version 1.7.10: Ownership transfer in admin log. --- Telegram/Resources/langs/lang.strings | 1 + .../history/admin_log/history_admin_log_item.cpp | 8 +++++++- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index e2cf6acb79..4f0190555d 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -1760,6 +1760,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_admin_log_banned" = "banned {user}"; "lng_admin_log_restricted" = "changed restrictions for {user} {until}"; "lng_admin_log_promoted" = "changed privileges for {user}"; +"lng_admin_log_transferred" = "transferred ownership to {user}"; "lng_admin_log_changed_default_permissions" = "changed default permissions"; "lng_admin_log_changed_stickers_group" = "{from} changed the group's {sticker_set}"; "lng_admin_log_changed_stickers_set" = "sticker set"; 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 70137da4b6..a40c6acb0f 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp @@ -264,7 +264,7 @@ auto GenerateParticipantChangeTextInner( const auto oldType = oldParticipant ? oldParticipant->type() : 0; return participant.match([&](const MTPDchannelParticipantCreator &data) { // No valid string here :( - return tr::lng_admin_log_invited( + return tr::lng_admin_log_transferred( tr::now, lt_user, GenerateUserString(data.vuser_id), @@ -575,6 +575,12 @@ void GenerateItems( }; auto createParticipantToggleAdmin = [&](const MTPDchannelAdminLogEventActionParticipantToggleAdmin &action) { + if (action.vnew_participant.type() == mtpc_channelParticipantAdmin + && action.vprev_participant.type() == mtpc_channelParticipantCreator) { + // In case of ownership transfer we show that message in + // the "User > Creator" part and skip the "Creator > Admin" part. + return; + } auto bodyFlags = Flag::f_entities | Flag::f_from_id; auto bodyReplyTo = 0; auto bodyViaBotId = 0;