mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 20:54:07 -08:00
fix(editor): Remove template creds setup from workflow when copied (no-changelog) (#9673)
This commit is contained in:
parent
b0b4093072
commit
1e15f73b0d
|
@ -34,7 +34,7 @@ describe('Template credentials setup', () => {
|
||||||
});
|
});
|
||||||
cy.intercept('GET', '**/rest/settings', (req) => {
|
cy.intercept('GET', '**/rest/settings', (req) => {
|
||||||
// Disable cache
|
// Disable cache
|
||||||
delete req.headers['if-none-match']
|
delete req.headers['if-none-match'];
|
||||||
req.reply((res) => {
|
req.reply((res) => {
|
||||||
if (res.body.data) {
|
if (res.body.data) {
|
||||||
// Disable custom templates host if it has been overridden by another intercept
|
// Disable custom templates host if it has been overridden by another intercept
|
||||||
|
@ -117,6 +117,7 @@ describe('Template credentials setup', () => {
|
||||||
const workflow = JSON.parse(workflowJSON);
|
const workflow = JSON.parse(workflowJSON);
|
||||||
|
|
||||||
expect(workflow.meta).to.haveOwnProperty('templateId', testTemplate.id.toString());
|
expect(workflow.meta).to.haveOwnProperty('templateId', testTemplate.id.toString());
|
||||||
|
expect(workflow.meta).not.to.haveOwnProperty('templateCredsSetupCompleted');
|
||||||
workflow.nodes.forEach((node: any) => {
|
workflow.nodes.forEach((node: any) => {
|
||||||
expect(Object.keys(node.credentials ?? {})).to.have.lengthOf(1);
|
expect(Object.keys(node.credentials ?? {})).to.have.lengthOf(1);
|
||||||
});
|
});
|
||||||
|
|
|
@ -260,7 +260,7 @@ export interface IWorkflowDataUpdate {
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface IWorkflowToShare extends IWorkflowDataUpdate {
|
export interface IWorkflowToShare extends IWorkflowDataUpdate {
|
||||||
meta?: WorkflowMetadata;
|
meta: WorkflowMetadata;
|
||||||
}
|
}
|
||||||
|
|
||||||
export interface NewWorkflowResponse {
|
export interface NewWorkflowResponse {
|
||||||
|
|
|
@ -403,7 +403,7 @@ async function onWorkflowMenuSelect(action: WORKFLOW_MENU_ACTIONS): Promise<void
|
||||||
const exportData: IWorkflowToShare = {
|
const exportData: IWorkflowToShare = {
|
||||||
...data,
|
...data,
|
||||||
meta: {
|
meta: {
|
||||||
...(props.workflow.meta ?? {}),
|
...props.workflow.meta,
|
||||||
instanceId: rootStore.instanceId,
|
instanceId: rootStore.instanceId,
|
||||||
},
|
},
|
||||||
tags: (tags ?? []).map((tagId) => {
|
tags: (tags ?? []).map((tagId) => {
|
||||||
|
|
|
@ -1997,12 +1997,14 @@ export default defineComponent({
|
||||||
void this.getNodesToSave(nodes).then((data) => {
|
void this.getNodesToSave(nodes).then((data) => {
|
||||||
const workflowToCopy: IWorkflowToShare = {
|
const workflowToCopy: IWorkflowToShare = {
|
||||||
meta: {
|
meta: {
|
||||||
...(this.workflowsStore.workflow.meta ?? {}),
|
...this.workflowsStore.workflow.meta,
|
||||||
instanceId: this.rootStore.instanceId,
|
instanceId: this.rootStore.instanceId,
|
||||||
},
|
},
|
||||||
...data,
|
...data,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
delete workflowToCopy.meta.templateCredsSetupCompleted;
|
||||||
|
|
||||||
this.workflowHelpers.removeForeignCredentialsFromWorkflow(
|
this.workflowHelpers.removeForeignCredentialsFromWorkflow(
|
||||||
workflowToCopy,
|
workflowToCopy,
|
||||||
this.credentialsStore.allCredentials,
|
this.credentialsStore.allCredentials,
|
||||||
|
|
Loading…
Reference in a new issue