From 08101ba6666777d4796999f6fceb31f40c69449a Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 25 Apr 2019 13:04:30 +0400 Subject: [PATCH] Forbid to archive Telegram Notifications. --- Telegram/SourceFiles/window/window_peer_menu.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/Telegram/SourceFiles/window/window_peer_menu.cpp b/Telegram/SourceFiles/window/window_peer_menu.cpp index c0443c3755..6b925de731 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.cpp +++ b/Telegram/SourceFiles/window/window_peer_menu.cpp @@ -53,6 +53,7 @@ public: private: bool showInfo(); + bool showToggleArchived(); void addPinToggle(); void addInfo(); //void addSearch(); @@ -194,6 +195,17 @@ bool Filler::showInfo() { return false; } +bool Filler::showToggleArchived() { + if (_source != PeerMenuSource::ChatsList) { + return false; + } else if (!_peer->isNotificationsUser()) { + return true; + } else if (const auto history = _peer->owner().historyLoaded(_peer)) { + return (history->folder() != nullptr); + } + return false; +} + void Filler::addPinToggle() { auto peer = _peer; auto isPinned = false; @@ -504,7 +516,7 @@ void Filler::fill() { } else if (const auto channel = _peer->asChannel()) { addChannelActions(channel); } - if (_source == PeerMenuSource::ChatsList) { + if (showToggleArchived()) { addToggleArchive(); } }