Skip to content

Commit a1ed9ed

Browse files
committed
updates
1 parent ded4aa7 commit a1ed9ed

File tree

1 file changed

+13
-8
lines changed

1 file changed

+13
-8
lines changed

components/asana/sources/task-field-updated-in-project/task-field-updated-in-project.mjs

Lines changed: 13 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ export default {
1313
...common.props,
1414
project: {
1515
label: "Project",
16-
description: "Gid of a project.",
16+
description: "GID of a project",
1717
type: "string",
1818
propDefinition: [
1919
asana,
@@ -37,20 +37,25 @@ export default {
3737
...common.methods,
3838
getWebhookFilter() {
3939
return {
40-
filters: [
41-
{
42-
action: "changed",
43-
resource_type: "task",
44-
fields: this.taskFields,
45-
},
46-
],
4740
resource: this.project,
4841
};
4942
},
43+
isRelevant({
44+
resource, change, parent,
45+
}) {
46+
const { taskFields } = this;
47+
return resource.resource_type === "task"
48+
&& (
49+
taskFields.includes(change?.field)
50+
|| taskFields.includes(parent?.resource_type)
51+
|| taskFields.find((field) => field.slice(0, -1) === parent?.resource_type)
52+
);
53+
},
5054
async emitEvent(event) {
5155
const { events = [] } = event.body || {};
5256

5357
const promises = events
58+
.filter((event) => this.isRelevant(event))
5459
.map(async (event) => ({
5560
event,
5661
task: (await this.asana.getTask({

0 commit comments

Comments
 (0)