From b401f0bfeacdf1cf828eb47424e93dbc6af92e35 Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Tue, 27 Dec 2022 21:55:44 +0300 Subject: [PATCH] Added phrase to admin log when user joined via public request. --- Telegram/Resources/langs/lang.strings | 2 ++ .../admin_log/history_admin_log_item.cpp | 34 ++++++++++++------- 2 files changed, 24 insertions(+), 12 deletions(-) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index d87f3bb49b..5f642ad105 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -3139,6 +3139,8 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL "lng_admin_log_participant_joined_by_link_channel" = "{from} joined the channel via {link}"; "lng_admin_log_participant_approved_by_link" = "{from} was approved to join the group via {link} by {user}"; "lng_admin_log_participant_approved_by_link_channel" = "{from} was approved to join the channel via {link} by {user}"; +"lng_admin_log_participant_approved_by_request" = "{from} joined to the group via public request, approved by {user}"; +"lng_admin_log_participant_approved_by_request_channel" = "{from} joined to the channel via public request, approved by {user}"; "lng_admin_log_revoke_invite_link" = "{from} revoked invite link {link}"; "lng_admin_log_delete_invite_link" = "{from} deleted invite link {link}"; "lng_admin_log_participant_left" = "{from} left the group"; 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 cdefc990d3..049d8f4e33 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp @@ -1494,20 +1494,30 @@ void GenerateItems( const auto createParticipantJoinByRequest = [&]( const LogJoinByRequest &data) { const auto user = channel->owner().user(UserId(data.vapproved_by())); - const auto text = (channel->isMegagroup() - ? tr::lng_admin_log_participant_approved_by_link - : tr::lng_admin_log_participant_approved_by_link_channel); const auto linkText = GenerateInviteLinkLink(data.vinvite()); + const auto text = (linkText.text == PublicJoinLink()) + ? (channel->isMegagroup() + ? tr::lng_admin_log_participant_approved_by_request + : tr::lng_admin_log_participant_approved_by_request_channel)( + tr::now, + lt_from, + fromLinkText, + lt_user, + Ui::Text::Link(user->name(), QString()), + Ui::Text::WithEntities) + : (channel->isMegagroup() + ? tr::lng_admin_log_participant_approved_by_link + : tr::lng_admin_log_participant_approved_by_link_channel)( + tr::now, + lt_from, + fromLinkText, + lt_link, + linkText, + lt_user, + Ui::Text::Link(user->name(), QString()), + Ui::Text::WithEntities); addInviteLinkServiceMessage( - text( - tr::now, - lt_from, - fromLinkText, - lt_link, - linkText, - lt_user, - Ui::Text::Link(user->name(), QString()), - Ui::Text::WithEntities), + text, data.vinvite(), user->createOpenLink()); };