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;
}
const attachBot = attachBots[chatId];
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(() => {
closeSymbolMenu();

View File

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

View File

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