mirror of
https://github.com/AyuGram/AyuGramDesktop.git
synced 2025-06-05 06:33:57 +02:00
Fixed display of toast about copying post link in corresponding window.
This commit is contained in:
parent
4de71408a2
commit
236b7bbf28
4 changed files with 13 additions and 10 deletions
|
@ -1270,7 +1270,7 @@ void FastShareMessage(
|
||||||
}
|
}
|
||||||
if (item->hasDirectLink()) {
|
if (item->hasDirectLink()) {
|
||||||
using namespace HistoryView;
|
using namespace HistoryView;
|
||||||
CopyPostLink(session, item->fullId(), Context::History);
|
CopyPostLink(controller, item->fullId(), Context::History);
|
||||||
} else if (const auto bot = item->getMessageBot()) {
|
} else if (const auto bot = item->getMessageBot()) {
|
||||||
if (const auto media = item->media()) {
|
if (const auto media = item->media()) {
|
||||||
if (const auto game = media->game()) {
|
if (const auto game = media->game()) {
|
||||||
|
|
|
@ -2208,7 +2208,7 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
||||||
}
|
}
|
||||||
if (item && item->hasDirectLink() && isUponSelected != 2 && isUponSelected != -2) {
|
if (item && item->hasDirectLink() && isUponSelected != 2 && isUponSelected != -2) {
|
||||||
_menu->addAction(item->history()->peer->isMegagroup() ? tr::lng_context_copy_message_link(tr::now) : tr::lng_context_copy_post_link(tr::now), [=] {
|
_menu->addAction(item->history()->peer->isMegagroup() ? tr::lng_context_copy_message_link(tr::now) : tr::lng_context_copy_post_link(tr::now), [=] {
|
||||||
HistoryView::CopyPostLink(session, itemId, HistoryView::Context::History);
|
HistoryView::CopyPostLink(controller, itemId, HistoryView::Context::History);
|
||||||
}, &st::menuIconLink);
|
}, &st::menuIconLink);
|
||||||
}
|
}
|
||||||
if (isUponSelected > 1) {
|
if (isUponSelected > 1) {
|
||||||
|
@ -2354,7 +2354,7 @@ void HistoryInner::showContextMenu(QContextMenuEvent *e, bool showFromTouch) {
|
||||||
&st::menuIconCopy);
|
&st::menuIconCopy);
|
||||||
} else if (item && item->hasDirectLink() && isUponSelected != 2 && isUponSelected != -2) {
|
} else if (item && item->hasDirectLink() && isUponSelected != 2 && isUponSelected != -2) {
|
||||||
_menu->addAction(item->history()->peer->isMegagroup() ? tr::lng_context_copy_message_link(tr::now) : tr::lng_context_copy_post_link(tr::now), [=] {
|
_menu->addAction(item->history()->peer->isMegagroup() ? tr::lng_context_copy_message_link(tr::now) : tr::lng_context_copy_post_link(tr::now), [=] {
|
||||||
HistoryView::CopyPostLink(session, itemId, HistoryView::Context::History);
|
HistoryView::CopyPostLink(controller, itemId, HistoryView::Context::History);
|
||||||
}, &st::menuIconLink);
|
}, &st::menuIconLink);
|
||||||
}
|
}
|
||||||
if (isUponSelected > 1) {
|
if (isUponSelected > 1) {
|
||||||
|
|
|
@ -325,11 +325,12 @@ void AddPostLinkAction(
|
||||||
const auto context = request.view
|
const auto context = request.view
|
||||||
? request.view->context()
|
? request.view->context()
|
||||||
: Context::History;
|
: Context::History;
|
||||||
|
const auto controller = request.navigation->parentController();
|
||||||
menu->addAction(
|
menu->addAction(
|
||||||
(item->history()->peer->isMegagroup()
|
(item->history()->peer->isMegagroup()
|
||||||
? tr::lng_context_copy_message_link
|
? tr::lng_context_copy_message_link
|
||||||
: tr::lng_context_copy_post_link)(tr::now),
|
: tr::lng_context_copy_post_link)(tr::now),
|
||||||
[=] { CopyPostLink(session, itemId, context); },
|
[=] { CopyPostLink(controller, itemId, context); },
|
||||||
&st::menuIconLink);
|
&st::menuIconLink);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1007,10 +1008,10 @@ base::unique_qptr<Ui::PopupMenu> FillContextMenu(
|
||||||
}
|
}
|
||||||
|
|
||||||
void CopyPostLink(
|
void CopyPostLink(
|
||||||
not_null<Main::Session*> session,
|
not_null<Window::SessionController*> controller,
|
||||||
FullMsgId itemId,
|
FullMsgId itemId,
|
||||||
Context context) {
|
Context context) {
|
||||||
const auto item = session->data().message(itemId);
|
const auto item = controller->session().data().message(itemId);
|
||||||
if (!item || !item->hasDirectLink()) {
|
if (!item || !item->hasDirectLink()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -1037,9 +1038,11 @@ void CopyPostLink(
|
||||||
return channel->hasUsername();
|
return channel->hasUsername();
|
||||||
}();
|
}();
|
||||||
|
|
||||||
Ui::Toast::Show(isPublicLink
|
Ui::Toast::Show(
|
||||||
? tr::lng_channel_public_link_copied(tr::now)
|
Window::Show(controller).toastParent(),
|
||||||
: tr::lng_context_about_private_link(tr::now));
|
isPublicLink
|
||||||
|
? tr::lng_channel_public_link_copied(tr::now)
|
||||||
|
: tr::lng_context_about_private_link(tr::now));
|
||||||
}
|
}
|
||||||
|
|
||||||
void AddPollActions(
|
void AddPollActions(
|
||||||
|
|
|
@ -51,7 +51,7 @@ base::unique_qptr<Ui::PopupMenu> FillContextMenu(
|
||||||
const ContextMenuRequest &request);
|
const ContextMenuRequest &request);
|
||||||
|
|
||||||
void CopyPostLink(
|
void CopyPostLink(
|
||||||
not_null<Main::Session*> session,
|
not_null<Window::SessionController*> controller,
|
||||||
FullMsgId itemId,
|
FullMsgId itemId,
|
||||||
Context context);
|
Context context);
|
||||||
void AddPollActions(
|
void AddPollActions(
|
||||||
|
|
Loading…
Add table
Reference in a new issue