Merge pull request #5562 from tsiegleauq/amendment-filter-new-workflow

Evaluate default amendment workflow in list
This commit is contained in:
Emanuel Schütze 2020-09-17 15:00:57 +02:00 committed by GitHub
commit 3d7bfe652c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 13 additions and 2 deletions

View File

@ -120,4 +120,11 @@ export class AmendmentFilterListService extends MotionFilterListService {
return [this.motionFilterOptions].concat(super.getFilterDefinitions());
}
}
/**
* Override the parents 'isWorkflowEnabled', only consider the enabledWorkflows.amendment
*/
protected isWorkflowEnabled(workflowId: number): boolean {
return workflowId === this.enabledWorkflows.amendment;
}
}

View File

@ -44,7 +44,7 @@ export class MotionFilterListService extends BaseFilterListService<ViewMotion> {
/**
* Listen to the configuration for change in defined/used workflows
*/
private enabledWorkflows = { statuteEnabled: false, statute: null, motion: null };
protected enabledWorkflows = { statuteEnabled: false, statute: null, motion: null, amendment: null };
/**
* Determine to show amendments in the motion list
@ -216,6 +216,10 @@ export class MotionFilterListService extends BaseFilterListService<ViewMotion> {
this.enabledWorkflows.motion = +id;
});
this.config.get<string>('motions_amendments_workflow').subscribe(id => {
this.enabledWorkflows.amendment = +id;
});
this.config.get<boolean>('motions_statutes_enabled').subscribe(bool => {
this.enabledWorkflows.statuteEnabled = bool;
});
@ -343,7 +347,7 @@ export class MotionFilterListService extends BaseFilterListService<ViewMotion> {
});
}
private isWorkflowEnabled(workflowId: number): boolean {
protected isWorkflowEnabled(workflowId: number): boolean {
return (
workflowId === this.enabledWorkflows.motion ||
(this.enabledWorkflows.statuteEnabled && workflowId === this.enabledWorkflows.statute)