mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-09-01 17:43:03 +02:00
fix: multi forward
This commit is contained in:
parent
41e46e4924
commit
a3b9059a39
3 changed files with 54 additions and 3 deletions
|
@ -3788,7 +3788,7 @@ void ApiWrap::sendMessage(MessageToSend &&message) {
|
|||
? Data::CanSendTexts(topic)
|
||||
: Data::CanSendTexts(peer);
|
||||
|
||||
if (!canSendTexts || AyuForward::isForwarding(peer->id) || Api::SendDice(message)) {
|
||||
if (!canSendTexts && !AyuForward::isForwarding(peer->id) || Api::SendDice(message)) {
|
||||
return;
|
||||
}
|
||||
local().saveRecentSentHashtags(textWithTags.text);
|
||||
|
|
|
@ -64,6 +64,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
// AyuGram includes
|
||||
#include "ayu/ayu_settings.h"
|
||||
#include "ayu/utils/telegram_helpers.h"
|
||||
#include "ayu/features/forward/ayu_forward.h"
|
||||
|
||||
|
||||
class ShareBox::Inner final : public Ui::RpWidget {
|
||||
|
@ -1671,6 +1672,48 @@ ShareBox::SubmitCallback ShareBox::DefaultForwardCallback(
|
|||
result,
|
||||
msgIds);
|
||||
const auto requestType = Data::Histories::RequestType::Send;
|
||||
|
||||
|
||||
// AyuGram-changed
|
||||
const auto dismiss = [=]
|
||||
{
|
||||
if (show->valid()) {
|
||||
show->hideLayer();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
if (AyuForward::isFullAyuForwardNeeded(items.front())) {
|
||||
crl::async([=]{
|
||||
for (const auto thread : result) {
|
||||
AyuForward::forwardMessages(
|
||||
&history->owner().session(),
|
||||
Api::SendAction(thread, options),
|
||||
false,
|
||||
Data::ResolvedForwardDraft(items, forwardOptions));
|
||||
}
|
||||
});
|
||||
|
||||
dismiss();
|
||||
return;
|
||||
}
|
||||
if (AyuForward::isAyuForwardNeeded(items)) {
|
||||
crl::async([=]
|
||||
{
|
||||
for (const auto thread : result) {
|
||||
AyuForward::intelligentForward(
|
||||
&history->owner().session(),
|
||||
Api::SendAction(thread, options),
|
||||
Data::ResolvedForwardDraft(items, forwardOptions));
|
||||
}
|
||||
});
|
||||
|
||||
dismiss();
|
||||
return;
|
||||
}
|
||||
// AyuGram-changed
|
||||
|
||||
|
||||
for (const auto thread : result) {
|
||||
if (!comment.text.isEmpty()) {
|
||||
auto message = Api::MessageToSend(
|
||||
|
|
|
@ -107,7 +107,7 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL
|
|||
// AyuGram includes
|
||||
#include "styles/style_ayu_icons.h"
|
||||
#include "ayu/ui/context_menu/context_menu.h"
|
||||
|
||||
#include "ayu/features/forward/ayu_forward.h"
|
||||
|
||||
namespace Window {
|
||||
namespace {
|
||||
|
@ -2579,9 +2579,17 @@ QPointer<Ui::BoxContent> ShowForwardMessagesBox(
|
|||
std::move(comment),
|
||||
options,
|
||||
state->box->forwardOptionsData());
|
||||
if (!state->submit && successCallback) {
|
||||
|
||||
// AyuGram-changed
|
||||
|
||||
// workaround for deselecting messages when using AyuForward
|
||||
const auto items = history->owner().idsToItems(msgIds);
|
||||
auto ayuForwarding = AyuForward::isAyuForwardNeeded(items) || AyuForward::isFullAyuForwardNeeded(items.front());
|
||||
|
||||
if (!state->submit || ayuForwarding && successCallback) {
|
||||
successCallback();
|
||||
}
|
||||
// AyuGram-changed
|
||||
};
|
||||
|
||||
const auto sendMenuType = [=] {
|
||||
|
|
Loading…
Add table
Reference in a new issue