Don't drop reply info on empty message submit.

This commit is contained in:
John Preston 2023-10-31 13:08:32 +04:00
parent ade97fd2d2
commit 46d3f232af
2 changed files with 9 additions and 1 deletions

View File

@ -842,7 +842,9 @@ HistoryWidget::HistoryWidget(
}); });
} else { } else {
fastShowAtEnd(action.history); fastShowAtEnd(action.history);
if (cancelReply(lastKeyboardUsed) && !action.clearDraft) { if (!_justMarkingAsRead
&& cancelReply(lastKeyboardUsed)
&& !action.clearDraft) {
saveCloudDraft(); saveCloudDraft();
} }
} }
@ -3963,7 +3965,12 @@ void HistoryWidget::send(Api::SendOptions options) {
ignoreSlowmodeCountdown)) { ignoreSlowmodeCountdown)) {
return; return;
} }
// Just a flag not to drop reply info if we're not sending anything.
_justMarkingAsRead = !HasSendText(_field)
&& message.webPage.url.isEmpty();
session().api().sendMessage(std::move(message)); session().api().sendMessage(std::move(message));
_justMarkingAsRead = false;
clearFieldText(); clearFieldText();
if (_preview) { if (_preview) {

View File

@ -812,6 +812,7 @@ private:
int _itemsRevealHeight = 0; int _itemsRevealHeight = 0;
bool _sponsoredMessagesStateKnown = false; bool _sponsoredMessagesStateKnown = false;
bool _justMarkingAsRead = false;
object_ptr<Ui::PlainShadow> _topShadow; object_ptr<Ui::PlainShadow> _topShadow;
bool _inGrab = false; bool _inGrab = false;