refactor(core): Port workflows config (no-changelog) (#10173)

This commit is contained in:
Iván Ovejero
2024-07-24 14:38:29 +02:00
committed by GitHub
parent 9056242b3a
commit b81f0bf9ea
8 changed files with 48 additions and 28 deletions

View File

@@ -43,6 +43,7 @@ import type { Project } from '@/databases/entities/Project';
import { ProjectRelationRepository } from '@/databases/repositories/projectRelation.repository';
import { z } from 'zod';
import { EventService } from '@/eventbus/event.service';
import { GlobalConfig } from '@n8n/config';
@RestController('/workflows')
export class WorkflowsController {
@@ -67,6 +68,7 @@ export class WorkflowsController {
private readonly projectService: ProjectService,
private readonly projectRelationRepository: ProjectRelationRepository,
private readonly eventService: EventService,
private readonly globalConfig: GlobalConfig,
) {}
@Post('/')
@@ -204,12 +206,12 @@ export class WorkflowsController {
@Get('/new')
async getNewName(req: WorkflowRequest.NewName) {
const requestedName = req.query.name ?? config.getEnv('workflows.defaultName');
const requestedName = req.query.name ?? this.globalConfig.workflows.defaultName;
const name = await this.namingService.getUniqueWorkflowName(requestedName);
const onboardingFlowEnabled =
!config.getEnv('workflows.onboardingFlowDisabled') &&
!this.globalConfig.workflows.onboardingFlowDisabled &&
!req.user.settings?.isOnboarded &&
(await this.userOnboardingService.isBelowThreshold(req.user));