Fix inline query draft applying.

This commit is contained in:
John Preston 2024-04-22 15:06:48 +04:00
parent 7a6c55bd8a
commit 6f328b2ef8
2 changed files with 7 additions and 6 deletions

View File

@ -129,9 +129,12 @@ void ClearPeerCloudDraft(
history->applyCloudDraft(topicRootId);
}
void SetChatLinkDraft(
not_null<PeerData*> peer,
const TextWithEntities &draft) {
void SetChatLinkDraft(not_null<PeerData*> peer, TextWithEntities draft) {
static const auto kInlineStart = QRegularExpression("^@[a-zA-Z0-9_]");
if (kInlineStart.match(draft.text).hasMatch()) {
draft = TextWithEntities().append(' ').append(std::move(draft));
}
const auto textWithTags = TextWithTags{
draft.text,
TextUtilities::ConvertEntitiesToTextTags(draft.entities)

View File

@ -205,8 +205,6 @@ using HistoryDrafts = base::flat_map<DraftKey, std::unique_ptr<Draft>>;
&& (a->webpage == b->webpage);
}
void SetChatLinkDraft(
not_null<PeerData*> peer,
const TextWithEntities &draft);
void SetChatLinkDraft(not_null<PeerData*> peer, TextWithEntities draft);
} // namespace Data