fix: Webhook category subscriptions do not work correctly, closes #5257

This commit is contained in:
Tom Moor
2023-04-26 08:59:24 -04:00
parent 01707d733a
commit f1ce23dce9

View File

@@ -14,7 +14,7 @@ import useCurrentTeam from "~/hooks/useCurrentTeam";
import useMobile from "~/hooks/useMobile"; import useMobile from "~/hooks/useMobile";
const WEBHOOK_EVENTS = { const WEBHOOK_EVENTS = {
user: [ users: [
"users.create", "users.create",
"users.signin", "users.signin",
"users.update", "users.update",
@@ -25,7 +25,7 @@ const WEBHOOK_EVENTS = {
"users.promote", "users.promote",
"users.demote", "users.demote",
], ],
document: [ documents: [
"documents.create", "documents.create",
"documents.publish", "documents.publish",
"documents.unpublish", "documents.unpublish",
@@ -38,7 +38,7 @@ const WEBHOOK_EVENTS = {
"documents.update", "documents.update",
"documents.title_change", "documents.title_change",
], ],
collection: [ collections: [
"collections.create", "collections.create",
"collections.update", "collections.update",
"collections.delete", "collections.delete",
@@ -49,30 +49,30 @@ const WEBHOOK_EVENTS = {
"collections.move", "collections.move",
"collections.permission_changed", "collections.permission_changed",
], ],
comment: ["comments.create", "comments.update", "comments.delete"], comments: ["comments.create", "comments.update", "comments.delete"],
revision: ["revisions.create"], revisions: ["revisions.create"],
fileOperation: [ fileOperations: [
"fileOperations.create", "fileOperations.create",
"fileOperations.update", "fileOperations.update",
"fileOperations.delete", "fileOperations.delete",
], ],
group: [ groups: [
"groups.create", "groups.create",
"groups.update", "groups.update",
"groups.delete", "groups.delete",
"groups.add_user", "groups.add_user",
"groups.remove_user", "groups.remove_user",
], ],
integration: ["integrations.create", "integrations.update"], integrations: ["integrations.create", "integrations.update"],
share: ["shares.create", "shares.update", "shares.revoke"], shares: ["shares.create", "shares.update", "shares.revoke"],
team: ["teams.update"], teams: ["teams.update"],
pin: ["pins.create", "pins.update", "pins.delete"], pins: ["pins.create", "pins.update", "pins.delete"],
webhookSubscription: [ webhookSubscriptions: [
"webhookSubscriptions.create", "webhookSubscriptions.create",
"webhookSubscriptions.delete", "webhookSubscriptions.delete",
"webhookSubscriptions.update", "webhookSubscriptions.update",
], ],
view: ["views.create"], views: ["views.create"],
}; };
const EventCheckboxLabel = styled.label` const EventCheckboxLabel = styled.label`
@@ -283,7 +283,9 @@ function WebhookSubscriptionForm({ handleSubmit, webhookSubscription }: Props) {
.map(([group, events], i) => ( .map(([group, events], i) => (
<GroupWrapper key={i} isMobile={isMobile}> <GroupWrapper key={i} isMobile={isMobile}>
<EventCheckbox <EventCheckbox
label={t(`All {{ groupName }} events`, { groupName: group })} label={t(`All {{ groupName }} events`, {
groupName: group.replace(/s$/, ""),
})}
value={group} value={group}
/> />
<FieldSet disabled={selectedGroups.includes(group)}> <FieldSet disabled={selectedGroups.includes(group)}>