mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-08-02 18:21:53 +00:00
Don't accept drafts older than last saved.
I hope it finally fixes #4922, partially fixes #10001. The rest of #10001 like RAM usage / crashes are unrelated to drafts.
This commit is contained in:
@@ -48,7 +48,11 @@ void ApplyPeerCloudDraft(
|
||||
PeerId peerId,
|
||||
const MTPDdraftMessage &draft) {
|
||||
const auto history = session->data().history(peerId);
|
||||
const auto textWithTags = TextWithTags {
|
||||
const auto date = draft.vdate().v;
|
||||
if (history->skipCloudDraftUpdate(date)) {
|
||||
return;
|
||||
}
|
||||
const auto textWithTags = TextWithTags{
|
||||
qs(draft.vmessage()),
|
||||
TextUtilities::ConvertEntitiesToTextTags(
|
||||
Api::EntitiesFromMTP(
|
||||
@@ -56,9 +60,6 @@ void ApplyPeerCloudDraft(
|
||||
draft.ventities().value_or_empty()))
|
||||
};
|
||||
const auto replyTo = draft.vreply_to_msg_id().value_or_empty();
|
||||
if (history->skipCloudDraft(textWithTags.text, replyTo, draft.vdate().v)) {
|
||||
return;
|
||||
}
|
||||
auto cloudDraft = std::make_unique<Draft>(
|
||||
textWithTags,
|
||||
replyTo,
|
||||
@@ -66,7 +67,7 @@ void ApplyPeerCloudDraft(
|
||||
(draft.is_no_webpage()
|
||||
? Data::PreviewState::Cancelled
|
||||
: Data::PreviewState::Allowed));
|
||||
cloudDraft->date = draft.vdate().v;
|
||||
cloudDraft->date = date;
|
||||
|
||||
history->setCloudDraft(std::move(cloudDraft));
|
||||
history->applyCloudDraft();
|
||||
@@ -77,7 +78,7 @@ void ClearPeerCloudDraft(
|
||||
PeerId peerId,
|
||||
TimeId date) {
|
||||
const auto history = session->data().history(peerId);
|
||||
if (history->skipCloudDraft(QString(), MsgId(0), date)) {
|
||||
if (history->skipCloudDraftUpdate(date)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user