From 23b6e5e66dd872d246c4f95b3da7a16e8284cef3 Mon Sep 17 00:00:00 2001 From: zubiden <19638254+zubiden@users.noreply.github.com> Date: Tue, 6 Aug 2024 20:06:29 +0200 Subject: [PATCH] Mini Apps: Fix check for bot trust (#4835) --- src/global/actions/api/bots.ts | 2 +- src/global/selectors/chats.ts | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/global/actions/api/bots.ts b/src/global/actions/api/bots.ts index 50a61c5d5..2cfa71da0 100644 --- a/src/global/actions/api/bots.ts +++ b/src/global/actions/api/bots.ts @@ -639,7 +639,7 @@ addActionHandler('requestAppWebView', async (global, actions, payload): Promise< return; } - if (botApp.isInactive && !selectIsTrustedBot(global, botId)) { + if (botApp.isInactive || !selectIsTrustedBot(global, botId)) { global = updateTabState(global, { botTrustRequest: { botId, diff --git a/src/global/selectors/chats.ts b/src/global/selectors/chats.ts index 6b0eaf55a..32f73526f 100644 --- a/src/global/selectors/chats.ts +++ b/src/global/selectors/chats.ts @@ -87,8 +87,7 @@ export function selectChatOnlineCount(global: T, chat: Ap } export function selectIsTrustedBot(global: T, botId: string) { - const bot = selectUser(global, botId); - return bot && (bot.isVerified || global.trustedBotIds.includes(botId)); + return global.trustedBotIds.includes(botId); } export function selectChatType(global: T, chatId: string) : ApiChatType | undefined {