mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2026-08-01 01:45:06 +00:00
Cloud draft handling improved. Fixed Edit while already editing a msg.
This commit is contained in:
@@ -23,6 +23,7 @@ Copyright (c) 2014-2016 John Preston, https://desktop.telegram.org
|
||||
|
||||
#include "historywidget.h"
|
||||
#include "mainwidget.h"
|
||||
#include "localstorage.h"
|
||||
|
||||
namespace Data {
|
||||
namespace {
|
||||
@@ -35,7 +36,7 @@ void applyPeerCloudDraft(PeerId peerId, const MTPDdraftMessage &draft) {
|
||||
auto entities = draft.has_entities() ? entitiesFromMTP(draft.ventities.c_vector().v) : EntitiesInText();
|
||||
TextWithTags textWithTags = { textApplyEntities(text, entities), textTagsFromEntities(entities) };
|
||||
MsgId replyTo = draft.has_reply_to_msg_id() ? draft.vreply_to_msg_id.v : 0;
|
||||
auto cloudDraft = std_::make_unique<HistoryDraft>(textWithTags, replyTo, MessageCursor(QFIXED_MAX, QFIXED_MAX, QFIXED_MAX), draft.is_no_webpage());
|
||||
auto cloudDraft = std_::make_unique<Draft>(textWithTags, replyTo, MessageCursor(QFIXED_MAX, QFIXED_MAX, QFIXED_MAX), draft.is_no_webpage());
|
||||
cloudDraft->date = ::date(draft.vdate);
|
||||
|
||||
history->setCloudDraft(std_::move(cloudDraft));
|
||||
@@ -48,4 +49,18 @@ void applyPeerCloudDraft(PeerId peerId, const MTPDdraftMessage &draft) {
|
||||
}
|
||||
}
|
||||
|
||||
void clearPeerCloudDraft(PeerId peerId) {
|
||||
auto history = App::history(peerId);
|
||||
|
||||
history->clearCloudDraft();
|
||||
history->clearLocalDraft();
|
||||
|
||||
history->updateChatListSortPosition();
|
||||
history->updateChatListEntry();
|
||||
|
||||
if (auto main = App::main()) {
|
||||
main->applyCloudDraft(history);
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace Data
|
||||
|
||||
Reference in New Issue
Block a user