diff --git a/Telegram/SourceFiles/apiwrap.cpp b/Telegram/SourceFiles/apiwrap.cpp index e8ba4a54cf..e47ddf991d 100644 --- a/Telegram/SourceFiles/apiwrap.cpp +++ b/Telegram/SourceFiles/apiwrap.cpp @@ -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); diff --git a/Telegram/SourceFiles/boxes/share_box.cpp b/Telegram/SourceFiles/boxes/share_box.cpp index fb02fa7a8f..7af67590c0 100644 --- a/Telegram/SourceFiles/boxes/share_box.cpp +++ b/Telegram/SourceFiles/boxes/share_box.cpp @@ -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( diff --git a/Telegram/SourceFiles/window/window_peer_menu.cpp b/Telegram/SourceFiles/window/window_peer_menu.cpp index da58c91829..3460e106f2 100644 --- a/Telegram/SourceFiles/window/window_peer_menu.cpp +++ b/Telegram/SourceFiles/window/window_peer_menu.cpp @@ -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 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 = [=] {