Fix drafts in topics.

This commit is contained in:
John Preston 2023-10-24 13:10:17 +04:00
parent 91ab82c9da
commit 2d3e2b1ef8
2 changed files with 4 additions and 5 deletions

View file

@ -46,7 +46,8 @@ MTPInputReplyTo ReplyToForMTP(
} }
} }
} else if (replyTo.messageId || replyTo.topicRootId) { } else if (replyTo.messageId || replyTo.topicRootId) {
const auto external = (replyTo.messageId.peer != history->peer->id); const auto external = replyTo.messageId
&& (replyTo.messageId.peer != history->peer->id);
const auto quoteEntities = Api::EntitiesToMTP( const auto quoteEntities = Api::EntitiesToMTP(
&history->session(), &history->session(),
replyTo.quote.entities, replyTo.quote.entities,
@ -61,9 +62,7 @@ MTPInputReplyTo ReplyToForMTP(
| (quoteEntities.v.isEmpty() | (quoteEntities.v.isEmpty()
? Flag() ? Flag()
: Flag::f_quote_entities)), : Flag::f_quote_entities)),
MTP_int(replyTo.messageId MTP_int(replyTo.messageId ? replyTo.messageId.msg : 0),
? replyTo.messageId.msg
: replyTo.topicRootId),
MTP_int(replyTo.topicRootId), MTP_int(replyTo.topicRootId),
(external (external
? owner->peer(replyTo.messageId.peer)->input ? owner->peer(replyTo.messageId.peer)->input

View file

@ -275,7 +275,7 @@ Data::Draft *History::createCloudDraft(
if (Data::DraftIsNull(fromDraft)) { if (Data::DraftIsNull(fromDraft)) {
setCloudDraft(std::make_unique<Data::Draft>( setCloudDraft(std::make_unique<Data::Draft>(
TextWithTags(), TextWithTags(),
FullReplyTo(), FullReplyTo{ .topicRootId = topicRootId },
MessageCursor(), MessageCursor(),
Data::WebPageDraft())); Data::WebPageDraft()));
cloudDraft(topicRootId)->date = TimeId(0); cloudDraft(topicRootId)->date = TimeId(0);