OpenPanel is an open-source web and product analytics platform, an open-source alternative to Mixpanel with optional self-hosting.
try(dashboard): slack integration window does not work (test 1)
Carl-Gerhard Lindesvärd30f16c5be6a8
diff --git a/apps/api/src/controllers/webhook.controller.ts b/apps/api/src/controllers/webhook.controller.tsindex cb3b02b68..440acbeb9 100644--- a/apps/api/src/controllers/webhook.controller.ts+++ b/apps/api/src/controllers/webhook.controller.ts@@ -250,7 +250,10 @@ export async function slackWebhook(}),);- reply.send({ success: true });+ return reply+ .status(200)+ .header('Content-Type', 'text/html')+ .send('<h1>Slack integration added. You can close this window now.</h1>');} catch (err) {request.log.error(err);return replydiff --git a/apps/dashboard/src/components/integrations/forms/slack-integration.tsx b/apps/dashboard/src/components/integrations/forms/slack-integration.tsxindex 30d3b6d96..fe7143237 100644--- a/apps/dashboard/src/components/integrations/forms/slack-integration.tsx+++ b/apps/dashboard/src/components/integrations/forms/slack-integration.tsx@@ -19,11 +19,12 @@ export function SlackIntegrationForm({defaultValues?: RouterOutputs['integration']['get'];onSuccess: () => void;}) {- const popup = useRef<Window | null>(null);const { organizationId } = useAppParams();useWS(`/live/integrations/slack?organizationId=${organizationId}`, (res) => {- if (popup.current) {- popup.current.close();+ // @ts-expect-error+ if (window.slackPopup && typeof window.slackPopup.close === 'function') {+ // @ts-expect-error+ window.slackPopup.close();}onSuccess();});@@ -42,14 +43,17 @@ export function SlackIntegrationForm({const height = 800;const left = window.screenX + (window.outerWidth - width) / 2;const top = window.screenY + (window.outerHeight - height) / 2.5;- popup.current = window.open(+ // @ts-expect-error+ window.slackPopup = window.open(url,'',`toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=no, copyhistory=no, width=${width}, height=${height}, top=${top}, left=${left}`,);// The popup might have been blocked, so we redirect the user to the URL instead- if (!popup.current) {+ //+ // @ts-expect-error+ if (!window.slackPopup) {window.location.href = url;}},