From 2e514a748c28071861a4c8656b5a36a9ea3f232e Mon Sep 17 00:00:00 2001 From: ZavaruKitsu Date: Tue, 2 Jan 2024 18:40:11 +0300 Subject: [PATCH] feat: open pack owner from box --- .../SourceFiles/boxes/sticker_set_box.cpp | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/Telegram/SourceFiles/boxes/sticker_set_box.cpp b/Telegram/SourceFiles/boxes/sticker_set_box.cpp index 82e4e3deb..44a216842 100644 --- a/Telegram/SourceFiles/boxes/sticker_set_box.cpp +++ b/Telegram/SourceFiles/boxes/sticker_set_box.cpp @@ -61,6 +61,12 @@ https://github.com/telegramdesktop/tdesktop/blob/master/LEGAL #include #include +// AyuGram includes +#include "ayu/utils/telegram_helpers.h" +#include "window/window_session_controller.h" +#include "data/data_user.h" + + namespace { constexpr auto kStickersPerRow = 5; @@ -536,6 +542,26 @@ void StickerSetBox::updateButtons() { ? tr::lng_stickers_copied_emoji(tr::now) : tr::lng_stickers_copied(tr::now)); }; + const auto addAuthorPack = [=](const std::shared_ptr>& menu) { + if (type == Data::StickersType::Stickers) { + (*menu)->addAction(tr::ayu_MessageDetailsPackOwnerPC(tr::now), [=] + { + searchById(_inner->setId() >> 32, _session, [=](const QString &username, UserData *user) + { + if (!user) { + showToast(tr::ayu_MessageDetailsPackOwnerNotFoundPC(tr::now)); + return; + } + + if (const auto window = _session->tryResolveWindow()) { + if (const auto mainWidget = window->widget()->sessionController()) { + mainWidget->showPeer(user); + } + } + }); + }, &st::menuIconProfile); + } + }; if (_inner->notInstalled()) { if (!_session->premium() && _session->premiumPossible() @@ -582,6 +608,7 @@ void StickerSetBox::updateButtons() { : tr::lng_stickers_share_pack)(tr::now), [=] { share(); closeBox(); }, &st::menuIconShare); + addAuthorPack(menu); (*menu)->popup(QCursor::pos()); return true; }); @@ -631,6 +658,7 @@ void StickerSetBox::updateButtons() { archive, &st::menuIconArchive); } + addAuthorPack(menu); (*menu)->popup(QCursor::pos()); return true; });