From 59e0717dac99ccb5e16356ce81df454ffd70a76d Mon Sep 17 00:00:00 2001 From: John Preston Date: Mon, 26 Oct 2020 12:03:39 +0300 Subject: [PATCH] Show pin/unpin correctly in Recent Actions. --- .../history/admin_log/history_admin_log_item.cpp | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-) 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 caba03439..e1b1da1df 100644 --- a/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp +++ b/Telegram/SourceFiles/history/admin_log/history_admin_log_item.cpp @@ -533,11 +533,11 @@ void GenerateItems( }; auto createUpdatePinned = [&](const MTPDchannelAdminLogEventActionUpdatePinned &action) { - if (action.vmessage().type() == mtpc_messageEmpty) { - auto text = tr::lng_admin_log_unpinned_message(tr::now, lt_from, fromLinkText); - addSimpleServiceMessage(text); - } else { - auto text = tr::lng_admin_log_pinned_message(tr::now, lt_from, fromLinkText); + action.vmessage().match([&](const MTPDmessage &data) { + const auto pinned = data.is_pinned(); + auto text = (pinned + ? tr::lng_admin_log_pinned_message + : tr::lng_admin_log_unpinned_message)(tr::now, lt_from, fromLinkText); addSimpleServiceMessage(text); auto detachExistingItem = false; @@ -548,7 +548,10 @@ void GenerateItems( date), MTPDmessage_ClientFlag::f_admin_log_entry, detachExistingItem)); - } + }, [&](const auto &) { + auto text = tr::lng_admin_log_unpinned_message(tr::now, lt_from, fromLinkText); + addSimpleServiceMessage(text); + }); }; auto createEditMessage = [&](const MTPDchannelAdminLogEventActionEditMessage &action) {