From a7d9aa947bdc89bb62c03569a9f94c3d3e150e06 Mon Sep 17 00:00:00 2001 From: John Preston Date: Thu, 18 Jul 2019 10:37:10 +0200 Subject: [PATCH] Don't allow in-notification reply with slowmode. --- .../SourceFiles/window/notifications_manager.cpp | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/Telegram/SourceFiles/window/notifications_manager.cpp b/Telegram/SourceFiles/window/notifications_manager.cpp index 0d492ce55..33c492a89 100644 --- a/Telegram/SourceFiles/window/notifications_manager.cpp +++ b/Telegram/SourceFiles/window/notifications_manager.cpp @@ -444,9 +444,14 @@ Manager::DisplayOptions Manager::getNotificationOptions(HistoryItem *item) { || Global::ScreenIsLocked(); DisplayOptions result; - result.hideNameAndPhoto = hideEverything || (Global::NotifyView() > dbinvShowName); - result.hideMessageText = hideEverything || (Global::NotifyView() > dbinvShowPreview); - result.hideReplyButton = result.hideMessageText || !item || !item->history()->peer->canWrite(); + result.hideNameAndPhoto = hideEverything + || (Global::NotifyView() > dbinvShowName); + result.hideMessageText = hideEverything + || (Global::NotifyView() > dbinvShowPreview); + result.hideReplyButton = result.hideMessageText + || !item + || !item->history()->peer->canWrite() + || (item->history()->peer->slowmodeSecondsLeft() > 0); return result; } @@ -510,11 +515,11 @@ void Manager::notificationReplied( message.textWithTags = reply; message.replyTo = (msgId > 0 && !history->peer->isUser()) ? msgId : 0; message.clearDraft = false; - Auth().api().sendMessage(std::move(message)); + history->session().api().sendMessage(std::move(message)); const auto item = history->owner().message(history->channelId(), msgId); if (item && item->isUnreadMention() && !item->isUnreadMedia()) { - Auth().api().markMediaRead(item); + history->session().api().markMediaRead(item); } }