mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
fix(core): Prevent workflow history saving error from happening (#7812)
When performing actions such as renaming a workflow or updating its settings, n8n errors with "Failed to save workflow version" in the console although the saving process was successful. We are now correctly checking whether `nodes` and `connections` exist and only then save a snapshot. Github issue / Community forum post (link here to close automatically):
This commit is contained in:
42
packages/cli/test/unit/shared/mockObjects.ts
Normal file
42
packages/cli/test/unit/shared/mockObjects.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import { User } from '@db/entities/User';
|
||||
import { Role } from '@db/entities/Role';
|
||||
import { CredentialsEntity } from '@db/entities/CredentialsEntity';
|
||||
|
||||
import {
|
||||
randomCredentialPayload,
|
||||
randomEmail,
|
||||
randomInteger,
|
||||
randomName,
|
||||
} from '../../integration/shared/random';
|
||||
|
||||
export const wfOwnerRole = () =>
|
||||
Object.assign(new Role(), {
|
||||
scope: 'workflow',
|
||||
name: 'owner',
|
||||
id: randomInteger(),
|
||||
});
|
||||
|
||||
export const mockCredRole = (name: 'owner' | 'editor'): Role =>
|
||||
Object.assign(new Role(), {
|
||||
scope: 'credentials',
|
||||
name,
|
||||
id: randomInteger(),
|
||||
});
|
||||
|
||||
export const mockCredential = (): CredentialsEntity =>
|
||||
Object.assign(new CredentialsEntity(), randomCredentialPayload());
|
||||
|
||||
export const mockUser = (): User =>
|
||||
Object.assign(new User(), {
|
||||
id: randomInteger(),
|
||||
email: randomEmail(),
|
||||
firstName: randomName(),
|
||||
lastName: randomName(),
|
||||
});
|
||||
|
||||
export const mockInstanceOwnerRole = () =>
|
||||
Object.assign(new Role(), {
|
||||
scope: 'global',
|
||||
name: 'owner',
|
||||
id: randomInteger(),
|
||||
});
|
||||
Reference in New Issue
Block a user