File tree Expand file tree Collapse file tree 1 file changed +14
-18
lines changed
packages/backend/src/apps/gathersg/auth Expand file tree Collapse file tree 1 file changed +14
-18
lines changed Original file line number Diff line number Diff line change 11import { z } from 'zod'
22
3- function validateUpdatedBy ( updatedBy : { email ?: string ; name ?: string } ) {
4- /**
5- * SPECIAL CASE
6- * if the workflow had an update step before sending the webhook,
7- * the webhook will return with:
8- * {
9- * updatedBy: {
10- * name: 'Workflow',
11- * },
12- * }
13- */
14- if ( updatedBy . name === 'Workflow' ) {
15- return ! updatedBy . email
16- }
17- return ! ! updatedBy . email
18- }
19-
203/**
214 * check for potential infinite loop
225 * if the webhook is not triggered by a user, it will not contain
@@ -50,7 +33,20 @@ const schema = z
5033
5134 // if updatedBy exists, check updatedBy first
5235 if ( updatedBy ) {
53- return validateUpdatedBy ( updatedBy )
36+ if ( updatedBy . name === 'Workflow' ) {
37+ /**
38+ * SPECIAL CASE
39+ * if the workflow had an update step before sending the webhook,
40+ * the webhook will return with:
41+ * {
42+ * updatedBy: {
43+ * name: 'Workflow',
44+ * },
45+ * }
46+ */
47+ return ! updatedBy . email
48+ }
49+ return ! ! updatedBy . email
5450 }
5551
5652 // if only createdBy exists, check for createdBy.email
You can’t perform that action at this time.
0 commit comments