2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-09-02 07:25:46 +00:00

Support topic on-the-fly creation.

This commit is contained in:
John Preston
2022-10-04 19:34:45 +04:00
parent 065d2e2ac9
commit 3722e55b67
32 changed files with 447 additions and 130 deletions

View File

@@ -148,10 +148,10 @@ void SendExistingMedia(
history,
replyTo,
randomId,
MTPmessages_SendMedia(
Data::Histories::PrepareMessage<MTPmessages_SendMedia>(
MTP_flags(sendFlags),
peer->input,
MTP_int(replyTo),
Data::Histories::ReplyToPlaceholder(),
inputMedia(),
MTP_string(captionText),
MTP_long(randomId),
@@ -314,10 +314,10 @@ bool SendDice(MessageToSend &message) {
history,
replyTo,
randomId,
MTPmessages_SendMedia(
Data::Histories::PrepareMessage<MTPmessages_SendMedia>(
MTP_flags(sendFlags),
peer->input,
MTP_int(replyTo),
Data::Histories::ReplyToPlaceholder(),
MTP_inputMediaDice(MTP_string(emoji)),
MTP_string(),
MTP_long(randomId),
@@ -347,9 +347,9 @@ void SendConfirmedFile(
&& (file->to.replaceMediaOf != 0);
const auto newId = FullMsgId(
file->to.peer,
isEditing
(isEditing
? file->to.replaceMediaOf
: session->data().nextLocalMessageId());
: session->data().nextLocalMessageId()));
const auto groupId = file->album ? file->album->groupId : uint64(0);
if (file->album) {
const auto proj = [](const SendingAlbum::Item &item) {
@@ -360,15 +360,21 @@ void SendConfirmedFile(
it->msgId = newId;
}
session->uploader().upload(newId, file);
const auto itemToEdit = isEditing
? session->data().message(newId)
: nullptr;
const auto history = session->data().history(file->to.peer);
const auto peer = history->peer;
if (!isEditing) {
file->to.replyTo = session->data().histories().convertTopicReplyTo(
history,
file->to.replyTo);
}
session->uploader().upload(newId, file);
auto action = SendAction(history, file->to.options);
action.clearDraft = false;
action.replyTo = file->to.replyTo;