From 346547c23d21ae5f25befac3ab736610ed3e0e7a Mon Sep 17 00:00:00 2001 From: 23rd <23rd@vivaldi.net> Date: Sun, 22 Nov 2020 06:35:00 +0300 Subject: [PATCH] Fixed draft applying while recording voice message in HistoryWidget. --- .../SourceFiles/history/history_widget.cpp | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/Telegram/SourceFiles/history/history_widget.cpp b/Telegram/SourceFiles/history/history_widget.cpp index b8a243a202..aa92502368 100644 --- a/Telegram/SourceFiles/history/history_widget.cpp +++ b/Telegram/SourceFiles/history/history_widget.cpp @@ -821,6 +821,13 @@ void HistoryWidget::initVoiceRecordBar() { }, lifetime()); _voiceRecordBar->hideFast(); + + _voiceRecordBar->shownValue( + ) | rpl::start_with_next([=](bool shown) { + if (!shown) { + applyDraft(); + } + }, lifetime()); } void HistoryWidget::initTabbedSelector() { @@ -2082,8 +2089,15 @@ bool HistoryWidget::contentOverlapped(const QRect &globalRect) { } bool HistoryWidget::canWriteMessage() const { - if (!_history || !_canSendMessages) return false; - if (isBlocked() || isJoinChannel() || isMuteUnmute() || isBotStart()) return false; + if (!_history || !_canSendMessages) { + return false; + } + if (isBlocked() || isJoinChannel() || isMuteUnmute() || isBotStart()) { + return false; + } + if (!_voiceRecordBar->isHidden()) { + return false; + } return true; }