Version 4.6.2: Fix ghost drafts appearing in channels.

This commit is contained in:
John Preston 2023-02-08 15:48:05 +04:00
parent 84b4ab1c3c
commit ee1162faff
2 changed files with 8 additions and 5 deletions

View file

@ -1867,11 +1867,11 @@ void HistoryWidget::fastShowAtEnd(not_null<History*> history) {
} }
} }
void HistoryWidget::applyDraft(FieldHistoryAction fieldHistoryAction) { bool HistoryWidget::applyDraft(FieldHistoryAction fieldHistoryAction) {
InvokeQueued(this, [=] { updateStickersByEmoji(); }); InvokeQueued(this, [=] { updateStickersByEmoji(); });
if (_voiceRecordBar->isActive() || !_canSendTexts) { if (_voiceRecordBar->isActive() || !_canSendTexts) {
return; return false;
} }
const auto editDraft = _history ? _history->localEditDraft({}) : nullptr; const auto editDraft = _history ? _history->localEditDraft({}) : nullptr;
@ -1893,7 +1893,7 @@ void HistoryWidget::applyDraft(FieldHistoryAction fieldHistoryAction) {
updateControlsGeometry(); updateControlsGeometry();
} }
refreshTopBarActiveChat(); refreshTopBarActiveChat();
return; return true;
} }
_textUpdateEvents = 0; _textUpdateEvents = 0;
@ -1930,6 +1930,7 @@ void HistoryWidget::applyDraft(FieldHistoryAction fieldHistoryAction) {
_processingReplyId = draft ? draft->msgId : MsgId(); _processingReplyId = draft ? draft->msgId : MsgId();
processReply(); processReply();
} }
return true;
} }
void HistoryWidget::applyCloudDraft(History *history) { void HistoryWidget::applyCloudDraft(History *history) {
@ -2261,7 +2262,9 @@ void HistoryWidget::showHistory(
handlePeerUpdate(); handlePeerUpdate();
session().local().readDraftsWithCursors(_history); session().local().readDraftsWithCursors(_history);
applyDraft(); if (!applyDraft()) {
clearFieldText();
}
_send->finishAnimating(); _send->finishAnimating();
updateControlsGeometry(); updateControlsGeometry();

View file

@ -213,7 +213,7 @@ public:
void botCallbackSent(not_null<HistoryItem*> item); void botCallbackSent(not_null<HistoryItem*> item);
void fastShowAtEnd(not_null<History*> history); void fastShowAtEnd(not_null<History*> history);
void applyDraft( bool applyDraft(
FieldHistoryAction fieldHistoryAction = FieldHistoryAction::Clear); FieldHistoryAction fieldHistoryAction = FieldHistoryAction::Clear);
void showHistory(const PeerId &peer, MsgId showAtMsgId, bool reload = false); void showHistory(const PeerId &peer, MsgId showAtMsgId, bool reload = false);
void setChooseReportMessagesDetails( void setChooseReportMessagesDetails(