mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
feat(core): block workflow update on interim change (#4397)
* ⚡ Add `updatedAt` to store * ⚡ Set `updatedAt` in store * 👕 Update FE types * 👕 Update BE types * ⚡ Set `updatedAt` on workflow open * ⚡ Add endpoint check * ⚡ Add first update check * 🔥 Remove log * ⚡ Simplify check * ⚡ Make `makeWorkflow` more flexible * 🗃️ Make `updatedAt` default consistent * 🧪 Adjust tests checking for `updatedAt` * 🧪 Add tests for interim changes block * ✏️ Remove unneeded quotes * ⏪ Simplify without using `-1` * 👕 Simplify interfaces * 🐛 Fix calls to `setWorkflowUpdatedAt` setter * :track: Move update to API call * ⚡ Restrict check to multiple users only * 🧪 Add more tests * 🐛 Account for activation outside of canvas * ✏️ Add warning comment * 🔥 Remove unneeded check * ⏪ Revert to `new Date()` for `-1` * 🐛 Fix display for never updated
This commit is contained in:
@@ -400,6 +400,7 @@ export const workflowHelpers = mixins(
|
||||
active: this.$store.getters.isActive,
|
||||
settings: this.$store.getters.workflowSettings,
|
||||
tags: this.$store.getters.workflowTags,
|
||||
updatedAt: this.$store.getters.workflowUpdatedAt,
|
||||
};
|
||||
|
||||
const workflowId = this.$store.getters.workflowId;
|
||||
@@ -660,6 +661,9 @@ export const workflowHelpers = mixins(
|
||||
const isCurrentWorkflow = workflowId === this.$store.getters.workflowId;
|
||||
if (isCurrentWorkflow) {
|
||||
data = await this.getWorkflowDataToSave();
|
||||
} else {
|
||||
const { updatedAt } = await this.restApi().getWorkflow(workflowId);
|
||||
data.updatedAt = updatedAt as string;
|
||||
}
|
||||
|
||||
if (active !== undefined) {
|
||||
@@ -667,6 +671,7 @@ export const workflowHelpers = mixins(
|
||||
}
|
||||
|
||||
const workflow = await this.restApi().updateWorkflow(workflowId, data);
|
||||
this.$store.commit('setWorkflowUpdatedAt', workflow.updatedAt);
|
||||
|
||||
if (isCurrentWorkflow) {
|
||||
this.$store.commit('setActive', !!workflow.active);
|
||||
@@ -714,6 +719,7 @@ export const workflowHelpers = mixins(
|
||||
|
||||
this.$store.commit('setStateDirty', false);
|
||||
this.$store.commit('removeActiveAction', 'workflowSaving');
|
||||
this.$store.commit('setWorkflowUpdatedAt', workflowData.updatedAt);
|
||||
this.$externalHooks().run('workflow.afterUpdate', { workflowData });
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user