Bot Button: Fix opening web app (#2320)

This commit is contained in:
Alexander Zinchuk 2023-01-22 18:12:17 +01:00
parent 661b2b62e0
commit 89db13f7c8
3 changed files with 6 additions and 8 deletions

View File

@ -786,12 +786,10 @@ const Composer: FC<OwnProps & StateProps> = ({
return; return;
} }
const attachBot = attachBots[chatId];
callAttachBot({ callAttachBot({
bot: attachBot, chatId, isFromBotMenu: true, url: botMenuButton.url, threadId, chatId, url: botMenuButton.url, threadId,
}); });
}, [attachBots, botMenuButton, callAttachBot, chatId, threadId]); }, [botMenuButton, callAttachBot, chatId, threadId]);
const handleActivateBotCommandMenu = useCallback(() => { const handleActivateBotCommandMenu = useCallback(() => {
closeSymbolMenu(); closeSymbolMenu();

View File

@ -592,8 +592,9 @@ async function loadAttachBots(hash?: string) {
addActionHandler('callAttachBot', (global, actions, payload) => { addActionHandler('callAttachBot', (global, actions, payload) => {
const { const {
chatId, bot, isFromBotMenu, url, startParam, threadId, chatId, bot, url, startParam, threadId,
} = payload; } = payload;
const isFromBotMenu = !bot;
if (!isFromBotMenu && !global.attachMenu.bots[bot.id]) { if (!isFromBotMenu && !global.attachMenu.bots[bot.id]) {
return { return {
...global, ...global,
@ -611,7 +612,7 @@ addActionHandler('callAttachBot', (global, actions, payload) => {
actions.requestWebView({ actions.requestWebView({
url, url,
peerId: chatId, peerId: chatId,
botId: bot.id, botId: isFromBotMenu ? chatId : bot.id,
theme, theme,
buttonText: '', buttonText: '',
isFromBotMenu, isFromBotMenu,

View File

@ -1178,8 +1178,7 @@ export interface ActionPayloads {
callAttachBot: { callAttachBot: {
chatId: string; chatId: string;
threadId?: number; threadId?: number;
bot: ApiAttachBot; bot?: ApiAttachBot;
isFromBotMenu?: boolean;
url?: string; url?: string;
startParam?: string; startParam?: string;
}; };