diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index 3b5d05a23..f6e15331f 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -2920,7 +2920,7 @@ void HistoryWidget::send(Api::SendOptions options) { } else if (_editMsgId) { saveEditMsg(); return; - } else if (showSlowmodeError()) { + } else if (!options.scheduled && showSlowmodeError()) { return; } @@ -2940,7 +2940,8 @@ void HistoryWidget::send(Api::SendOptions options) { const auto error = GetErrorTextForSending( _peer, _toForward, - message.textWithTags); + message.textWithTags, + options.scheduled); if (!error.isEmpty()) { ShowErrorToast(error); return; @@ -2994,11 +2995,23 @@ SendMenuType HistoryWidget::sendMenuType() const { : SendMenuType::Scheduled; } +auto HistoryWidget::computeSendButtonType() const { + using Type = Ui::SendButton::Type; + + if (_editMsgId) { + return Type::Save; + } else if (_isInlineBot) { + return Type::Cancel; + } else if (showRecordButton()) { + return Type::Record; + } + return Type::Send; +} + SendMenuType HistoryWidget::sendButtonMenuType() const { - return ((_send->type() != Ui::SendButton::Type::Send) - || _send->isDisabled()) - ? SendMenuType::Disabled - : sendMenuType(); + return (computeSendButtonType() == Ui::SendButton::Type::Send) + ? sendMenuType() + : SendMenuType::Disabled; } void HistoryWidget::unblockUser() { @@ -3702,16 +3715,8 @@ bool HistoryWidget::showInlineBotCancel() const { void HistoryWidget::updateSendButtonType() { using Type = Ui::SendButton::Type; - const auto type = [&] { - if (_editMsgId) { - return Type::Save; - } else if (_isInlineBot) { - return Type::Cancel; - } else if (showRecordButton()) { - return Type::Record; - } - return Type::Send; - }(); + + const auto type = computeSendButtonType(); _send->setType(type); const auto delay = [&] { diff --git a/Telegram/SourceFiles/history/history_widget.h b/Telegram/SourceFiles/history/history_widget.h index 95facf594..c621bc9c5 100644 --- a/Telegram/SourceFiles/history/history_widget.h +++ b/Telegram/SourceFiles/history/history_widget.h @@ -404,6 +404,7 @@ private: void clearHighlightMessages(); void stopMessageHighlight(); + auto computeSendButtonType() const; void updateSendAction( not_null history, SendAction::Type type,