2
0
mirror of https://github.com/kotatogram/kotatogram-desktop synced 2025-08-31 06:35:14 +00:00

Pass FullReplyTo everywhere.

This commit is contained in:
John Preston
2023-10-10 10:49:22 +04:00
parent a77131dfd6
commit 4240568ea5
53 changed files with 964 additions and 744 deletions

View File

@@ -112,7 +112,10 @@ void ShareBotGame(
}
histories.sendPreparedMessage(
history,
FullReplyTo{ .msgId = replyTo, .topicRootId = topicRootId },
FullReplyTo{
.messageId = { replyTo ? history->peer->id : 0, replyTo },
.topicRootId = topicRootId,
},
randomId,
Data::Histories::PrepareMessage<MTPmessages_SendMedia>(
MTP_flags(flags),
@@ -1036,16 +1039,12 @@ void Filler::addCreatePoll() {
? SendMenu::Type::SilentOnly
: SendMenu::Type::Scheduled;
const auto flag = PollData::Flags();
const auto topicRootId = _request.rootId;
const auto replyToId = _request.currentReplyToId
? _request.currentReplyToId
: topicRootId;
const auto replyTo = _request.currentReplyTo;
auto callback = [=] {
PeerMenuCreatePoll(
controller,
peer,
replyToId,
topicRootId,
replyTo,
flag,
flag,
source,
@@ -1464,8 +1463,7 @@ void PeerMenuShareContactBox(
void PeerMenuCreatePoll(
not_null<Window::SessionController*> controller,
not_null<PeerData*> peer,
MsgId replyToId,
MsgId topicRootId,
FullReplyTo replyTo,
PollData::Flags chosen,
PollData::Flags disabled,
Api::SendType sendType,
@@ -1490,10 +1488,12 @@ void PeerMenuCreatePoll(
auto action = Api::SendAction(
peer->owner().history(peer),
result.options);
action.clearDraft = false;
action.replyTo = { .msgId = replyToId, .topicRootId = topicRootId };
action.replyTo = replyTo;
const auto topicRootId = replyTo.topicRootId;
if (const auto local = action.history->localDraft(topicRootId)) {
action.clearDraft = local->textWithTags.text.isEmpty();
} else {
action.clearDraft = false;
}
const auto api = &peer->session().api();
api->polls().create(result.poll, action, crl::guard(weak, [=] {
@@ -1637,7 +1637,7 @@ void BlockSenderFromRepliesBox(
PeerMenuBlockUserBox(
box,
&controller->window(),
item->senderOriginal(),
item->originalSender(),
true,
Window::ClearReply{ id });
}