fix: Save new version of the workflow instead of the previous (no-changelog) (#7428)
Github issue / Community forum post (link here to close automatically):
This commit is contained in:
@@ -64,14 +64,14 @@ export class WorkflowHistoryService {
|
||||
return hist;
|
||||
}
|
||||
|
||||
async saveVersion(user: User, workflow: WorkflowEntity) {
|
||||
async saveVersion(user: User, workflow: WorkflowEntity, workflowId: string) {
|
||||
if (isWorkflowHistoryEnabled()) {
|
||||
await this.workflowHistoryRepository.insert({
|
||||
authors: user.firstName + ' ' + user.lastName,
|
||||
connections: workflow.connections,
|
||||
nodes: workflow.nodes,
|
||||
versionId: workflow.versionId,
|
||||
workflowId: workflow.id,
|
||||
workflowId,
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,6 +26,8 @@ import { RoleService } from '@/services/role.service';
|
||||
import * as utils from '@/utils';
|
||||
import { listQueryMiddleware } from '@/middlewares';
|
||||
import { TagService } from '@/services/tag.service';
|
||||
import { isWorkflowHistoryLicensed } from './workflowHistory/workflowHistoryHelper.ee';
|
||||
import { WorkflowHistoryService } from './workflowHistory/workflowHistory.service.ee';
|
||||
|
||||
export const workflowsController = express.Router();
|
||||
|
||||
@@ -99,6 +101,14 @@ workflowsController.post(
|
||||
throw new ResponseHelper.InternalServerError('Failed to save workflow');
|
||||
}
|
||||
|
||||
if (isWorkflowHistoryLicensed()) {
|
||||
await Container.get(WorkflowHistoryService).saveVersion(
|
||||
req.user,
|
||||
savedWorkflow,
|
||||
savedWorkflow.id,
|
||||
);
|
||||
}
|
||||
|
||||
if (tagIds && !config.getEnv('workflowTagsDisabled') && savedWorkflow.tags) {
|
||||
savedWorkflow.tags = Container.get(TagService).sortByRequestOrder(savedWorkflow.tags, {
|
||||
requestOrder: tagIds,
|
||||
|
||||
@@ -301,8 +301,8 @@ export class WorkflowsService {
|
||||
);
|
||||
}
|
||||
|
||||
if (isWorkflowHistoryLicensed()) {
|
||||
await Container.get(WorkflowHistoryService).saveVersion(user, shared.workflow);
|
||||
if (isWorkflowHistoryLicensed() && workflow.versionId !== shared.workflow.versionId) {
|
||||
await Container.get(WorkflowHistoryService).saveVersion(user, workflow, workflowId);
|
||||
}
|
||||
|
||||
const relations = config.getEnv('workflowTagsDisabled') ? [] : ['tags'];
|
||||
|
||||
Reference in New Issue
Block a user