From 3b73cb6a564c9a0d5c0714d988dccd347e9fe8a8 Mon Sep 17 00:00:00 2001 From: Omar Ajoue Date: Thu, 19 Aug 2021 15:26:38 +0200 Subject: [PATCH] Adjustments suggested by @mutdmour --- .../editor-ui/src/components/DuplicateWorkflowDialog.vue | 2 +- .../editor-ui/src/components/mixins/workflowHelpers.ts | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/packages/editor-ui/src/components/DuplicateWorkflowDialog.vue b/packages/editor-ui/src/components/DuplicateWorkflowDialog.vue index 2f570c4ea7..be8375b51d 100644 --- a/packages/editor-ui/src/components/DuplicateWorkflowDialog.vue +++ b/packages/editor-ui/src/components/DuplicateWorkflowDialog.vue @@ -109,7 +109,7 @@ export default mixins(showMessage, workflowHelpers).extend({ this.$data.isSaving = true; - const saved = await this.saveAsNewWorkflow({name, tags: this.currentTagIds, updateWebhookUrls: true}); + const saved = await this.saveAsNewWorkflow({name, tags: this.currentTagIds, resetWebhookUrls: true}); if (saved) { this.closeDialog(); diff --git a/packages/editor-ui/src/components/mixins/workflowHelpers.ts b/packages/editor-ui/src/components/mixins/workflowHelpers.ts index 4521523c69..656737358a 100644 --- a/packages/editor-ui/src/components/mixins/workflowHelpers.ts +++ b/packages/editor-ui/src/components/mixins/workflowHelpers.ts @@ -436,18 +436,19 @@ export const workflowHelpers = mixins( } }, - async saveAsNewWorkflow ({name, tags, updateWebhookUrls}: {name?: string, tags?: string[], updateWebhookUrls?: boolean} = {}): Promise { + async saveAsNewWorkflow ({name, tags, resetWebhookUrls}: {name?: string, tags?: string[], resetWebhookUrls?: boolean} = {}): Promise { try { this.$store.commit('addActiveAction', 'workflowSaving'); const workflowDataRequest: IWorkflowDataUpdate = await this.getWorkflowDataToSave(); // make sure that the new ones are not active workflowDataRequest.active = false; - if (updateWebhookUrls) { - workflowDataRequest.nodes!.forEach(node => { + if (resetWebhookUrls) { + workflowDataRequest.nodes = workflowDataRequest.nodes!.map(node => { if (node.webhookId) { node.webhookId = uuidv4(); } + return node; }); }