From 91dcfff423c6a61ab8b5680881bbb172d62e284a Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 28 Jun 2017 18:22:56 +0300 Subject: [PATCH] Add unpinned message admin log event action. --- Telegram/Resources/langs/lang.strings | 1 + .../history/history_admin_log_item.cpp | 15 ++++++++++----- 2 files changed, 11 insertions(+), 5 deletions(-) diff --git a/Telegram/Resources/langs/lang.strings b/Telegram/Resources/langs/lang.strings index 3f5d6591fc..63ed2b3c49 100644 --- a/Telegram/Resources/langs/lang.strings +++ b/Telegram/Resources/langs/lang.strings @@ -1347,6 +1347,7 @@ Copyright (c) 2014-2017 John Preston, https://desktop.telegram.org "lng_admin_log_signatures_enabled" = "{from} enabled signatures"; "lng_admin_log_signatures_disabled" = "{from} disabled signatures"; "lng_admin_log_pinned_message" = "{from} pinned message:"; +"lng_admin_log_unpinned_message" = "{from} unpinned message"; "lng_admin_log_edited_caption" = "{from} edited caption:"; "lng_admin_log_removed_caption" = "{from} removed caption"; "lng_admin_log_previous_caption" = "Original caption"; diff --git a/Telegram/SourceFiles/history/history_admin_log_item.cpp b/Telegram/SourceFiles/history/history_admin_log_item.cpp index 7fb6d4421d..66154d9663 100644 --- a/Telegram/SourceFiles/history/history_admin_log_item.cpp +++ b/Telegram/SourceFiles/history/history_admin_log_item.cpp @@ -327,12 +327,17 @@ void GenerateItems(gsl::not_null history, LocalIdManager &idManager, c }; auto createUpdatePinned = [&](const MTPDchannelAdminLogEventActionUpdatePinned &action) { - auto text = lng_admin_log_pinned_message(lt_from, fromLinkText); - addSimpleServiceMessage(text); + if (action.vmessage.type() == mtpc_messageEmpty) { + auto text = lng_admin_log_unpinned_message(lt_from, fromLinkText); + addSimpleServiceMessage(text); + } else { + auto text = lng_admin_log_pinned_message(lt_from, fromLinkText); + addSimpleServiceMessage(text); - auto applyServiceAction = false; - auto detachExistingItem = false; - addPart(history->createItem(PrepareLogMessage(action.vmessage, idManager.next(), date.v), applyServiceAction, detachExistingItem)); + auto applyServiceAction = false; + auto detachExistingItem = false; + addPart(history->createItem(PrepareLogMessage(action.vmessage, idManager.next(), date.v), applyServiceAction, detachExistingItem)); + } }; auto createEditMessage = [&](const MTPDchannelAdminLogEventActionEditMessage &action) {