mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fix forwarding to General topic.
This commit is contained in:
parent
e878ccccb4
commit
7f969e5102
2 changed files with 15 additions and 6 deletions
|
@ -3157,7 +3157,11 @@ void ApiWrap::forwardMessages(
|
||||||
if (sendAs) {
|
if (sendAs) {
|
||||||
sendFlags |= MTPmessages_ForwardMessages::Flag::f_send_as;
|
sendFlags |= MTPmessages_ForwardMessages::Flag::f_send_as;
|
||||||
}
|
}
|
||||||
if (action.topicRootId) {
|
const auto kGeneralId = Data::ForumTopic::kGeneralId;
|
||||||
|
const auto topMsgId = (action.topicRootId == kGeneralId)
|
||||||
|
? MsgId(0)
|
||||||
|
: action.topicRootId;
|
||||||
|
if (topMsgId) {
|
||||||
sendFlags |= MTPmessages_ForwardMessages::Flag::f_top_msg_id;
|
sendFlags |= MTPmessages_ForwardMessages::Flag::f_top_msg_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -3179,7 +3183,7 @@ void ApiWrap::forwardMessages(
|
||||||
MTP_vector<MTPint>(ids),
|
MTP_vector<MTPint>(ids),
|
||||||
MTP_vector<MTPlong>(randomIds),
|
MTP_vector<MTPlong>(randomIds),
|
||||||
peer->input,
|
peer->input,
|
||||||
MTP_int(action.topicRootId),
|
MTP_int(topMsgId),
|
||||||
MTP_int(action.options.scheduled),
|
MTP_int(action.options.scheduled),
|
||||||
(sendAs ? sendAs->input : MTP_inputPeerEmpty())
|
(sendAs ? sendAs->input : MTP_inputPeerEmpty())
|
||||||
)).done([=](const MTPUpdates &result) {
|
)).done([=](const MTPUpdates &result) {
|
||||||
|
@ -3232,7 +3236,7 @@ void ApiWrap::forwardMessages(
|
||||||
messageFromId,
|
messageFromId,
|
||||||
messagePostAuthor,
|
messagePostAuthor,
|
||||||
item,
|
item,
|
||||||
action.topicRootId);
|
topMsgId);
|
||||||
_session->data().registerMessageRandomId(randomId, newId);
|
_session->data().registerMessageRandomId(randomId, newId);
|
||||||
if (!localIds) {
|
if (!localIds) {
|
||||||
localIds = std::make_shared<base::flat_map<uint64, FullMsgId>>();
|
localIds = std::make_shared<base::flat_map<uint64, FullMsgId>>();
|
||||||
|
|
|
@ -1403,11 +1403,16 @@ ShareBox::SubmitCallback ShareBox::DefaultForwardCallback(
|
||||||
api.sendMessage(std::move(message));
|
api.sendMessage(std::move(message));
|
||||||
}
|
}
|
||||||
const auto topicRootId = thread->topicRootId();
|
const auto topicRootId = thread->topicRootId();
|
||||||
|
const auto kGeneralId = Data::ForumTopic::kGeneralId;
|
||||||
|
const auto topMsgId = (topicRootId == kGeneralId)
|
||||||
|
? MsgId(0)
|
||||||
|
: topicRootId;
|
||||||
const auto peer = thread->peer();
|
const auto peer = thread->peer();
|
||||||
histories.sendRequest(history, requestType, [=](Fn<void()> finish) {
|
histories.sendRequest(history, requestType, [=](
|
||||||
|
Fn<void()> finish) {
|
||||||
auto &api = history->session().api();
|
auto &api = history->session().api();
|
||||||
const auto sendFlags = commonSendFlags
|
const auto sendFlags = commonSendFlags
|
||||||
| (topicRootId ? Flag::f_top_msg_id : Flag(0))
|
| (topMsgId ? Flag::f_top_msg_id : Flag(0))
|
||||||
| (ShouldSendSilent(peer, options)
|
| (ShouldSendSilent(peer, options)
|
||||||
? Flag::f_silent
|
? Flag::f_silent
|
||||||
: Flag(0));
|
: Flag(0));
|
||||||
|
@ -1418,7 +1423,7 @@ ShareBox::SubmitCallback ShareBox::DefaultForwardCallback(
|
||||||
MTP_vector<MTPint>(mtpMsgIds),
|
MTP_vector<MTPint>(mtpMsgIds),
|
||||||
MTP_vector<MTPlong>(generateRandom()),
|
MTP_vector<MTPlong>(generateRandom()),
|
||||||
peer->input,
|
peer->input,
|
||||||
MTP_int(topicRootId),
|
MTP_int(topMsgId),
|
||||||
MTP_int(options.scheduled),
|
MTP_int(options.scheduled),
|
||||||
MTP_inputPeerEmpty() // send_as
|
MTP_inputPeerEmpty() // send_as
|
||||||
)).done([=](const MTPUpdates &updates, mtpRequestId reqId) {
|
)).done([=](const MTPUpdates &updates, mtpRequestId reqId) {
|
||||||
|
|
Loading…
Add table
Reference in a new issue