Follow-up team webhooks (#9052)

* fix subsriber url already defined error when editing webhook

* don't show form submitted for team and event type webhooks

---------

Co-authored-by: CarinaWolli <[email protected]>
This commit is contained in:
Carina WollendorferandCarinaWolli authored and GitHub committed 2023-05-23 06:26:09 +00:00
1 parent d469f1bc39
commit a6b96c9270
4 files changed
+11 -3

No files matched your search

@@ -44,6 +44,7 @@ const WebhookForm = (props: {
apps?: (keyof typeof WEBHOOK_TRIGGER_EVENTS_GROUPED_BY_APP_V2)[];
onSubmit: (event: WebhookFormSubmitData) => void;
onCancel?: () => void;
noRoutingFormTriggers: boolean;
}) => {
const { apps = [] } = props;
const { t } = useLocale();
@@ -51,6 +52,7 @@ const WebhookForm = (props: {
const triggerOptions = [...WEBHOOK_TRIGGER_EVENTS_GROUPED_BY_APP_V2["core"]];
if (apps) {
for (const app of apps) {
if (app === "routing-forms" && props.noRoutingFormTriggers) continue;
if (WEBHOOK_TRIGGER_EVENTS_GROUPED_BY_APP_V2[app]) {
triggerOptions.push(...WEBHOOK_TRIGGER_EVENTS_GROUPED_BY_APP_V2[app]);
}
@@ -59,6 +59,7 @@ const EditWebhook = () => {
/>
<WebhookForm
webhook={webhook}
noRoutingFormTriggers={!!webhook.teamId}
onSubmit={(values: WebhookFormSubmitData) => {
if (
subscriberUrlReserved({
@@ -79,8 +79,11 @@ const NewWebhookView = () => {
description={t("add_webhook_description", { appName: APP_NAME })}
backButton
/>
<WebhookForm onSubmit={onCreateWebhook} apps={installedApps?.items.map((app) => app.slug)} />
<WebhookForm
onSubmit={onCreateWebhook}
apps={installedApps?.items.map((app) => app.slug)}
noRoutingFormTriggers={!!teamId}
/>
</>
);
};