Browse Source

Merge pull request #9422 from nocodb/nc-fix/webhook-user

pull/7999/merge
Anbarasu 3 months ago committed by GitHub
parent
commit
c310572c24
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 39
      packages/nocodb/src/helpers/webhookHelpers.ts

39
packages/nocodb/src/helpers/webhookHelpers.ts

@ -227,6 +227,44 @@ export async function validateCondition(
break; break;
} }
if (
[UITypes.User, UITypes.CreatedBy, UITypes.LastModifiedBy].includes(
column.uidt,
)
) {
const userIds = Array.isArray(data[field])
? data[field].map((user) => user.id)
: data[field]?.id
? [data[field].id]
: [];
const filterValues = filter.value.split(',').map((v) => v.trim());
switch (filter.comparison_op) {
case 'anyof':
res = userIds.some((id) => filterValues.includes(id));
break;
case 'nanyof':
res = !userIds.some((id) => filterValues.includes(id));
break;
case 'allof':
res = filterValues.every((id) => userIds.includes(id));
break;
case 'nallof':
res = !filterValues.every((id) => userIds.includes(id));
break;
case 'empty':
case 'blank':
res = userIds.length === 0;
break;
case 'notempty':
case 'notblank':
res = userIds.length > 0;
break;
default:
res = false; // Unsupported operation for User fields
}
} else {
switch (filter.comparison_op) { switch (filter.comparison_op) {
case 'eq': case 'eq':
res = val == filter.value; res = val == filter.value;
@ -312,6 +350,7 @@ export async function validateCondition(
} }
} }
} }
}
switch (filter.logical_op) { switch (filter.logical_op) {
case 'or': case 'or':

Loading…
Cancel
Save