refactor(core): Decouple workflow created, saved, deleted events from internal hooks (no-changelog) (#10264)

This commit is contained in:
Iván Ovejero
2024-08-01 13:44:23 +02:00
committed by GitHub
parent efb71dd9ad
commit d8688bd463
8 changed files with 125 additions and 103 deletions

View File

@@ -179,8 +179,13 @@ export class WorkflowsController {
delete savedWorkflowWithMetaData.shared;
await this.externalHooks.run('workflow.afterCreate', [savedWorkflow]);
this.internalHooks.onWorkflowCreated(req.user, newWorkflow, project!, false);
this.eventService.emit('workflow-created', { user: req.user, workflow: newWorkflow });
this.eventService.emit('workflow-created', {
user: req.user,
workflow: newWorkflow,
publicApi: false,
projectId: project!.id,
projectType: project!.type,
});
const scopes = await this.workflowService.getWorkflowScopes(req.user, savedWorkflow.id);