diff --git a/src/global/actions/api/bots.ts b/src/global/actions/api/bots.ts index e7fa75714..a1c4db8b2 100644 --- a/src/global/actions/api/bots.ts +++ b/src/global/actions/api/bots.ts @@ -670,7 +670,7 @@ addActionHandler('loadPreviewMedias', async (global, actions, payload): Promise< addActionHandler('requestAppWebView', async (global, actions, payload): Promise => { const { - botId, appName, startApp, theme, isWriteAllowed, isFromConfirm, + botId, appName, startApp, theme, isWriteAllowed, isFromConfirm, shouldSkipBotTrustRequest, tabId = getCurrentTabId(), } = payload; @@ -719,7 +719,10 @@ addActionHandler('requestAppWebView', async (global, actions, payload): Promise< return; } - if (botApp.isInactive || !selectIsTrustedBot(global, botId)) { + const shouldRequestBotTrust = !shouldSkipBotTrustRequest && (botApp.isInactive || !selectIsTrustedBot(global, botId)); + + if (shouldRequestBotTrust) { + payload.shouldSkipBotTrustRequest = true; global = updateTabState(global, { botTrustRequest: { botId, diff --git a/src/global/actions/api/chats.ts b/src/global/actions/api/chats.ts index 93c75dfa3..ee32c3c1a 100644 --- a/src/global/actions/api/chats.ts +++ b/src/global/actions/api/chats.ts @@ -2891,6 +2891,7 @@ export async function checkWebAppExists( if (!botName || !appName) return false; global = getGlobal(); const chatByUsername = await fetchChatByUsername(global, botName); + global = getGlobal(); const bot = chatByUsername && selectUser(global, chatByUsername.id); const botApp = bot && await callApi('fetchBotApp', { bot, diff --git a/src/global/types.ts b/src/global/types.ts index 1db1b4bec..e9dbc1e53 100644 --- a/src/global/types.ts +++ b/src/global/types.ts @@ -2961,6 +2961,7 @@ export interface ActionPayloads { startApp?: string; isWriteAllowed?: boolean; isFromConfirm?: boolean; + shouldSkipBotTrustRequest?: boolean; } & WithTabId; loadPreviewMedias: { botId: string;