Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: Blacklisting webhooks #17421

Merged
merged 2 commits into from
Sep 14, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions frontend/src/lib/constants.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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_DENYLIST: 'webhooks-denylist', // owner: #team-pipeline
} as const
export type FeatureFlagKey = (typeof FEATURE_FLAGS)[keyof typeof FEATURE_FLAGS]

Expand Down
19 changes: 18 additions & 1 deletion frontend/src/scenes/project/Settings/WebhookIntegration.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,37 @@ 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) {
setWebhook(currentTeam?.slack_incoming_webhook)
}
}, [currentTeam])

const webhooks_blacklisted = featureFlags[FEATURE_FLAGS.WEBHOOKS_DENYLIST]
if (webhooks_blacklisted) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

related nit: probably good to align the variable name with the feature flag (or just if (featureFlags[FEATURE_FLAGS.WEBHOOKS_DENYLIST])

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merged cause I didn't want to wait for tests again 😅

return (
<div>
<p>
Webhooks are currently not available for your organization.{' '}
<Link onClick={() => openSupportForm('support', 'apps')}>Contact support</Link>
</p>
</div>
)
}

return (
<div>
<p>
Expand Down
Loading