mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-19 19:11:13 +00:00
fix(editor): Prevent error from showing-up when duplicating unsaved workflow (#5833)
* fix(editor): Prevent error from showing-up when duplicating unsaved workflow * Add unsaved workflow duplicate test
This commit is contained in:
@@ -89,10 +89,18 @@ export default mixins(showMessage, workflowHelpers, restApi).extend({
|
||||
computed: {
|
||||
...mapStores(useUsersStore, useSettingsStore, useWorkflowsStore),
|
||||
workflowPermissions(): IPermissions {
|
||||
return getWorkflowPermissions(
|
||||
this.usersStore.currentUser,
|
||||
this.workflowsStore.getWorkflowById(this.data.id),
|
||||
);
|
||||
const isEmptyWorkflow = this.data.id === PLACEHOLDER_EMPTY_WORKFLOW_ID;
|
||||
const isCurrentWorkflowEmpty =
|
||||
this.workflowsStore.workflow.id === PLACEHOLDER_EMPTY_WORKFLOW_ID;
|
||||
|
||||
// If the workflow to be duplicated is empty and the current workflow is also empty
|
||||
// we need to use the current workflow to get the permissions
|
||||
const currentWorkflow =
|
||||
isEmptyWorkflow && isCurrentWorkflowEmpty
|
||||
? this.workflowsStore.workflow
|
||||
: this.workflowsStore.getWorkflowById(this.data.id);
|
||||
|
||||
return getWorkflowPermissions(this.usersStore.currentUser, currentWorkflow);
|
||||
},
|
||||
},
|
||||
watch: {
|
||||
|
||||
Reference in New Issue
Block a user