From 66bf48e21e0ccb08cecf8d8657c539fed59f1198 Mon Sep 17 00:00:00 2001 From: John Preston Date: Sat, 31 Aug 2019 14:43:19 +0300 Subject: [PATCH] Remove 'Send without sound' in Saved messages. --- .../SourceFiles/chat_helpers/message_field.cpp | 2 +- .../SourceFiles/history/history_widget.cpp | 18 +++++++++++------- Telegram/SourceFiles/history/history_widget.h | 1 + 3 files changed, 13 insertions(+), 8 deletions(-) diff --git a/Telegram/SourceFiles/chat_helpers/message_field.cpp b/Telegram/SourceFiles/chat_helpers/message_field.cpp index 847f7a1d69..e9bbe69544 100644 --- a/Telegram/SourceFiles/chat_helpers/message_field.cpp +++ b/Telegram/SourceFiles/chat_helpers/message_field.cpp @@ -801,7 +801,7 @@ void SetupSendMenu( } *menu = base::make_unique_q(button); - if (silent) { + if (silent && now != SendMenuType::Reminder) { (*menu)->addAction(tr::lng_send_silent_message(tr::now), silent); } if (schedule && now != SendMenuType::SilentOnly) { diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 6c098b7e11..3b5d05a238 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -303,7 +303,7 @@ HistoryWidget::HistoryWidget( SetupSendMenu( _send, - [=] { return sendMenuType(); }, + [=] { return sendButtonMenuType(); }, [=] { sendSilent(); }, [=] { sendScheduled(); }); @@ -2987,16 +2987,20 @@ void HistoryWidget::sendScheduled() { } SendMenuType HistoryWidget::sendMenuType() const { - if (_send->type() != Ui::SendButton::Type::Send - || _send->isDisabled() - || !_peer) { - return SendMenuType::Disabled; - } - return _peer->isSelf() + return !_peer + ? SendMenuType::Disabled + : _peer->isSelf() ? SendMenuType::Reminder : SendMenuType::Scheduled; } +SendMenuType HistoryWidget::sendButtonMenuType() const { + return ((_send->type() != Ui::SendButton::Type::Send) + || _send->isDisabled()) + ? SendMenuType::Disabled + : sendMenuType(); +} + void HistoryWidget::unblockUser() { if (const auto user = _peer ? _peer->asUser() : nullptr) { Window::PeerMenuUnblockUserWithBotRestart(user); diff --git a/Telegram/SourceFiles/history/history_widget.h b/Telegram/SourceFiles/history/history_widget.h index 06ae204cd9..95facf5949 100644 --- a/Telegram/SourceFiles/history/history_widget.h +++ b/Telegram/SourceFiles/history/history_widget.h @@ -368,6 +368,7 @@ private: void sendSilent(); void sendScheduled(); [[nodiscard]] SendMenuType sendMenuType() const; + [[nodiscard]] SendMenuType sendButtonMenuType() const; void handlePendingHistoryUpdate(); void fullPeerUpdated(PeerData *peer); void toggleTabbedSelectorMode();