2
0
mirror of https://github.com/telegramdesktop/tdesktop synced 2025-08-31 06:26:18 +00:00

Pass context chat from one webview to another.

This commit is contained in:
John Preston
2023-08-15 15:01:18 +02:00
parent 87f52cf7df
commit d57d95c53f
7 changed files with 33 additions and 7 deletions

View File

@@ -38,6 +38,7 @@ class SessionController;
class PeerData;
struct ClickHandlerContext {
FullMsgId itemId;
QString attachBotWebviewUrl;
// Is filled from sections.
Fn<HistoryView::ElementDelegate*()> elementDelegate;
base::weak_ptr<Window::SessionController> sessionWindow;

View File

@@ -447,6 +447,7 @@ bool ResolveUsernameOrPhone(
? std::make_optional(params.value(u"voicechat"_q))
: std::nullopt),
.clickFromMessageId = myContext.itemId,
.clickFromAttachBotWebviewUrl = myContext.attachBotWebviewUrl,
});
return true;
}
@@ -473,7 +474,7 @@ bool ResolvePrivatePost(
if (!channelId || (msgId && !IsServerMsgId(msgId))) {
return false;
}
const auto fromMessageId = context.value<ClickHandlerContext>().itemId;
const auto my = context.value<ClickHandlerContext>();
using Navigation = Window::SessionNavigation;
controller->showPeerByLink(Navigation::PeerByLinkInfo{
.usernameOrId = channelId,
@@ -487,7 +488,8 @@ bool ResolvePrivatePost(
Navigation::ThreadId{ threadId }
}
: Navigation::RepliesByLinkInfo{ v::null },
.clickFromMessageId = fromMessageId,
.clickFromMessageId = my.itemId,
.clickFromAttachBotWebviewUrl = my.attachBotWebviewUrl,
});
controller->window().activate();
return true;