mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-19 19:11:13 +00:00
fix(core): Fix Filtering of Workflow by Tags (#5570)
This commit is contained in:
@@ -164,7 +164,7 @@ export class WorkflowsService {
|
|||||||
|
|
||||||
if (!config.getEnv('workflowTagsDisabled')) {
|
if (!config.getEnv('workflowTagsDisabled')) {
|
||||||
relations.push('tags');
|
relations.push('tags');
|
||||||
select.tags = { name: true };
|
select.tags = { id: true, name: true };
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isSharingEnabled()) {
|
if (isSharingEnabled()) {
|
||||||
|
|||||||
@@ -401,6 +401,7 @@ export async function createManyWorkflows(
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* Store a workflow in the DB (without a trigger) and optionally assign it to a user.
|
* Store a workflow in the DB (without a trigger) and optionally assign it to a user.
|
||||||
|
* @param attributes workflow attributes
|
||||||
* @param user user to assign the workflow to
|
* @param user user to assign the workflow to
|
||||||
*/
|
*/
|
||||||
export async function createWorkflow(attributes: Partial<WorkflowEntity> = {}, user?: User) {
|
export async function createWorkflow(attributes: Partial<WorkflowEntity> = {}, user?: User) {
|
||||||
|
|||||||
@@ -154,6 +154,7 @@ describe('GET /workflows', () => {
|
|||||||
test('should return workflows without nodes, sharing and credential usage details', async () => {
|
test('should return workflows without nodes, sharing and credential usage details', async () => {
|
||||||
const owner = await testDb.createUser({ globalRole: globalOwnerRole });
|
const owner = await testDb.createUser({ globalRole: globalOwnerRole });
|
||||||
const member = await testDb.createUser({ globalRole: globalMemberRole });
|
const member = await testDb.createUser({ globalRole: globalMemberRole });
|
||||||
|
const tag = await testDb.createTag({ name: 'test' });
|
||||||
|
|
||||||
const savedCredential = await saveCredential(randomCredentialPayload(), { user: owner });
|
const savedCredential = await saveCredential(randomCredentialPayload(), { user: owner });
|
||||||
|
|
||||||
@@ -175,6 +176,7 @@ describe('GET /workflows', () => {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
tags: [tag],
|
||||||
},
|
},
|
||||||
owner,
|
owner,
|
||||||
);
|
);
|
||||||
@@ -193,6 +195,14 @@ describe('GET /workflows', () => {
|
|||||||
expect(fetchedWorkflow.sharedWith).not.toBeDefined()
|
expect(fetchedWorkflow.sharedWith).not.toBeDefined()
|
||||||
expect(fetchedWorkflow.usedCredentials).not.toBeDefined()
|
expect(fetchedWorkflow.usedCredentials).not.toBeDefined()
|
||||||
expect(fetchedWorkflow.nodes).not.toBeDefined()
|
expect(fetchedWorkflow.nodes).not.toBeDefined()
|
||||||
|
expect(fetchedWorkflow.tags).toEqual(
|
||||||
|
expect.arrayContaining([
|
||||||
|
expect.objectContaining({
|
||||||
|
id: expect.any(String),
|
||||||
|
name: expect.any(String)
|
||||||
|
})
|
||||||
|
])
|
||||||
|
)
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user