Browse Source

fix: if no filter trigger on all change

pull/7246/head
Pranav C 12 months ago
parent
commit
2168aff54b
  1. 16
      packages/nocodb/src/helpers/webhookHelpers.ts

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

@ -301,6 +301,8 @@ export async function invokeWebhook(
} }
if (hook.condition && !testHook) { if (hook.condition && !testHook) {
const filters = testFilters || (await hook.getFilters());
if (isBulkOperation) { if (isBulkOperation) {
const filteredData = []; const filteredData = [];
for (let i = 0; i < newData.length; i++) { for (let i = 0; i < newData.length; i++) {
@ -308,12 +310,11 @@ export async function invokeWebhook(
const pData = prevData[i] ? prevData[i] : null; const pData = prevData[i] ? prevData[i] : null;
// if condition is satisfied for prevData then return // if condition is satisfied for prevData then return
// if filters are not defined then skip the check
if ( if (
pData && pData &&
(await validateCondition( filters.length &&
testFilters || (await hook.getFilters()), (await validateCondition(filters, pData))
pData,
))
) { ) {
continue; continue;
} }
@ -332,12 +333,11 @@ export async function invokeWebhook(
newData = filteredData; newData = filteredData;
} else { } else {
// if condition is satisfied for prevData then return // if condition is satisfied for prevData then return
// if filters are not defined then skip the check
if ( if (
prevData && prevData &&
(await validateCondition( filters.length &&
testFilters || (await hook.getFilters()), (await validateCondition(filters, prevData))
prevData,
))
) { ) {
return; return;
} }

Loading…
Cancel
Save