mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
fix(core): Comply with custom default for workflow saving settings (#7634)
https://linear.app/n8n/issue/PAY-982
This commit is contained in:
@@ -1,20 +1,24 @@
|
||||
import config from '@/config';
|
||||
import type { IWorkflowSettings } from 'n8n-workflow';
|
||||
|
||||
const DEFAULTS = {
|
||||
ERROR: config.getEnv('executions.saveDataOnError'),
|
||||
SUCCESS: config.getEnv('executions.saveDataOnSuccess'),
|
||||
MANUAL: config.getEnv('executions.saveDataManualExecutions'),
|
||||
};
|
||||
|
||||
/**
|
||||
* Return whether a workflow execution is configured to be saved or not,
|
||||
* for error executions, success executions, and manual executions.
|
||||
*/
|
||||
export function toSaveSettings(workflowSettings: IWorkflowSettings = {}) {
|
||||
const DEFAULTS = {
|
||||
ERROR: config.getEnv('executions.saveDataOnError'),
|
||||
SUCCESS: config.getEnv('executions.saveDataOnSuccess'),
|
||||
MANUAL: config.getEnv('executions.saveDataManualExecutions'),
|
||||
};
|
||||
|
||||
return {
|
||||
error: workflowSettings.saveDataErrorExecution !== 'none' ?? DEFAULTS.ERROR !== 'none',
|
||||
success: workflowSettings.saveDataSuccessExecution !== 'none' ?? DEFAULTS.SUCCESS !== 'none',
|
||||
error: workflowSettings.saveDataErrorExecution
|
||||
? workflowSettings.saveDataErrorExecution !== 'none'
|
||||
: DEFAULTS.ERROR !== 'none',
|
||||
success: workflowSettings.saveDataSuccessExecution
|
||||
? workflowSettings.saveDataSuccessExecution !== 'none'
|
||||
: DEFAULTS.SUCCESS !== 'none',
|
||||
manual: workflowSettings?.saveManualExecutions ?? DEFAULTS.MANUAL,
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user