From e664fba83869e9ed6e004d7a8cf883107d6badc7 Mon Sep 17 00:00:00 2001 From: Tiina Turban Date: Wed, 13 Sep 2023 18:14:27 +0200 Subject: [PATCH 1/2] feat: Blacklisting webhooks --- frontend/src/lib/constants.tsx | 1 + .../project/Settings/WebhookIntegration.tsx | 19 ++++++++++++++++++- 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx index 122f62be237a1..0f75c709c9054 100644 --- a/frontend/src/lib/constants.tsx +++ b/frontend/src/lib/constants.tsx @@ -166,6 +166,7 @@ export const FEATURE_FLAGS = { // owner: #team-monitoring SESSION_RECORDING_ALLOW_V1_SNAPSHOTS: 'session-recording-allow-v1-snapshots', HOGQL_INSIGHTS: 'hogql-insights', // owner: @mariusandra + WEBHOOKS_BLACKLISTED: 'webhooks-blacklisted', // owner: @team-pipeline } as const export type FeatureFlagKey = (typeof FEATURE_FLAGS)[keyof typeof FEATURE_FLAGS] diff --git a/frontend/src/scenes/project/Settings/WebhookIntegration.tsx b/frontend/src/scenes/project/Settings/WebhookIntegration.tsx index 83ba8c9a13114..bc4f7cba30ece 100644 --- a/frontend/src/scenes/project/Settings/WebhookIntegration.tsx +++ b/frontend/src/scenes/project/Settings/WebhookIntegration.tsx @@ -2,13 +2,18 @@ import { useEffect, useState } from 'react' import { useActions, useValues } from 'kea' import { teamLogic } from 'scenes/teamLogic' import { webhookIntegrationLogic } from './webhookIntegrationLogic' -import { LemonButton, LemonInput } from '@posthog/lemon-ui' +import { LemonButton, LemonInput, Link } from '@posthog/lemon-ui' +import { featureFlagLogic } from 'lib/logic/featureFlagLogic' +import { FEATURE_FLAGS } from 'lib/constants' +import { supportLogic } from 'lib/components/Support/supportLogic' export function WebhookIntegration(): JSX.Element { const [webhook, setWebhook] = useState('') const { testWebhook, removeWebhook } = useActions(webhookIntegrationLogic) const { loading } = useValues(webhookIntegrationLogic) const { currentTeam } = useValues(teamLogic) + const { featureFlags } = useValues(featureFlagLogic) + const { openSupportForm } = useActions(supportLogic) useEffect(() => { if (currentTeam?.slack_incoming_webhook) { @@ -16,6 +21,18 @@ export function WebhookIntegration(): JSX.Element { } }, [currentTeam]) + const webhooks_blacklisted = featureFlags[FEATURE_FLAGS.WEBHOOKS_BLACKLISTED] + if (webhooks_blacklisted) { + return ( +
+

+ Webhooks are currently not available for your organization.{' '} + openSupportForm('support', 'apps')}>Contact support +

+
+ ) + } + return (

From 1d4ab7937ca44d12a96386ecb04bc144a34453a7 Mon Sep 17 00:00:00 2001 From: Tiina Turban Date: Wed, 13 Sep 2023 18:35:50 +0200 Subject: [PATCH 2/2] naming nit --- frontend/src/lib/constants.tsx | 2 +- frontend/src/scenes/project/Settings/WebhookIntegration.tsx | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/frontend/src/lib/constants.tsx b/frontend/src/lib/constants.tsx index 0f75c709c9054..03047c582f7b6 100644 --- a/frontend/src/lib/constants.tsx +++ b/frontend/src/lib/constants.tsx @@ -166,7 +166,7 @@ export const FEATURE_FLAGS = { // owner: #team-monitoring SESSION_RECORDING_ALLOW_V1_SNAPSHOTS: 'session-recording-allow-v1-snapshots', HOGQL_INSIGHTS: 'hogql-insights', // owner: @mariusandra - WEBHOOKS_BLACKLISTED: 'webhooks-blacklisted', // owner: @team-pipeline + WEBHOOKS_DENYLIST: 'webhooks-denylist', // owner: #team-pipeline } as const export type FeatureFlagKey = (typeof FEATURE_FLAGS)[keyof typeof FEATURE_FLAGS] diff --git a/frontend/src/scenes/project/Settings/WebhookIntegration.tsx b/frontend/src/scenes/project/Settings/WebhookIntegration.tsx index bc4f7cba30ece..23caab8f00533 100644 --- a/frontend/src/scenes/project/Settings/WebhookIntegration.tsx +++ b/frontend/src/scenes/project/Settings/WebhookIntegration.tsx @@ -21,7 +21,7 @@ export function WebhookIntegration(): JSX.Element { } }, [currentTeam]) - const webhooks_blacklisted = featureFlags[FEATURE_FLAGS.WEBHOOKS_BLACKLISTED] + const webhooks_blacklisted = featureFlags[FEATURE_FLAGS.WEBHOOKS_DENYLIST] if (webhooks_blacklisted) { return (