mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fix clearing cloud draft on message send.
Regression was introduced in 20ba417ddd
.
This commit is contained in:
parent
98bd5757b0
commit
d4d2eef291
1 changed files with 11 additions and 7 deletions
|
@ -3582,11 +3582,12 @@ void ApiWrap::sendMessage(MessageToSend &&message) {
|
||||||
sendAction(action);
|
sendAction(action);
|
||||||
|
|
||||||
const auto clearCloudDraft = action.clearDraft;
|
const auto clearCloudDraft = action.clearDraft;
|
||||||
|
const auto draftTopicRootId = action.replyTo.topicRootId;
|
||||||
const auto replyTo = action.replyTo.messageId
|
const auto replyTo = action.replyTo.messageId
|
||||||
? peer->owner().message(action.replyTo.messageId)
|
? peer->owner().message(action.replyTo.messageId)
|
||||||
: nullptr;
|
: nullptr;
|
||||||
const auto topicRootId = action.replyTo.topicRootId
|
const auto topicRootId = draftTopicRootId
|
||||||
? action.replyTo.topicRootId
|
? draftTopicRootId
|
||||||
: replyTo
|
: replyTo
|
||||||
? replyTo->topicRootId()
|
? replyTo->topicRootId()
|
||||||
: Data::ForumTopic::kGeneralId;
|
: Data::ForumTopic::kGeneralId;
|
||||||
|
@ -3626,7 +3627,10 @@ void ApiWrap::sendMessage(MessageToSend &&message) {
|
||||||
TextUtilities::Trim(sending);
|
TextUtilities::Trim(sending);
|
||||||
|
|
||||||
_session->data().registerMessageRandomId(randomId, newId);
|
_session->data().registerMessageRandomId(randomId, newId);
|
||||||
_session->data().registerMessageSentData(randomId, peer->id, sending.text);
|
_session->data().registerMessageSentData(
|
||||||
|
randomId,
|
||||||
|
peer->id,
|
||||||
|
sending.text);
|
||||||
|
|
||||||
MTPstring msgText(MTP_string(sending.text));
|
MTPstring msgText(MTP_string(sending.text));
|
||||||
auto flags = NewMessageFlags(peer);
|
auto flags = NewMessageFlags(peer);
|
||||||
|
@ -3688,8 +3692,8 @@ void ApiWrap::sendMessage(MessageToSend &&message) {
|
||||||
if (clearCloudDraft) {
|
if (clearCloudDraft) {
|
||||||
sendFlags |= MTPmessages_SendMessage::Flag::f_clear_draft;
|
sendFlags |= MTPmessages_SendMessage::Flag::f_clear_draft;
|
||||||
mediaFlags |= MTPmessages_SendMedia::Flag::f_clear_draft;
|
mediaFlags |= MTPmessages_SendMedia::Flag::f_clear_draft;
|
||||||
history->clearCloudDraft(topicRootId);
|
history->clearCloudDraft(draftTopicRootId);
|
||||||
history->startSavingCloudDraft(topicRootId);
|
history->startSavingCloudDraft(draftTopicRootId);
|
||||||
}
|
}
|
||||||
const auto sendAs = action.options.sendAs;
|
const auto sendAs = action.options.sendAs;
|
||||||
const auto messageFromId = sendAs
|
const auto messageFromId = sendAs
|
||||||
|
@ -3726,7 +3730,7 @@ void ApiWrap::sendMessage(MessageToSend &&message) {
|
||||||
const MTP::Response &response) {
|
const MTP::Response &response) {
|
||||||
if (clearCloudDraft) {
|
if (clearCloudDraft) {
|
||||||
history->finishSavingCloudDraft(
|
history->finishSavingCloudDraft(
|
||||||
topicRootId,
|
draftTopicRootId,
|
||||||
UnixtimeFromMsgId(response.outerMsgId));
|
UnixtimeFromMsgId(response.outerMsgId));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -3740,7 +3744,7 @@ void ApiWrap::sendMessage(MessageToSend &&message) {
|
||||||
}
|
}
|
||||||
if (clearCloudDraft) {
|
if (clearCloudDraft) {
|
||||||
history->finishSavingCloudDraft(
|
history->finishSavingCloudDraft(
|
||||||
topicRootId,
|
draftTopicRootId,
|
||||||
UnixtimeFromMsgId(response.outerMsgId));
|
UnixtimeFromMsgId(response.outerMsgId));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
Loading…
Add table
Reference in a new issue