From 51512fd589ef34f349bac646ab10dc7d730035f7 Mon Sep 17 00:00:00 2001 From: Sean Date: Wed, 16 Sep 2020 11:55:02 +0200 Subject: [PATCH] Evaluate default amendment workflow in list Evaluates the default amendment workflow in the amendment list so users can se the filters accordingly --- .../motions/services/amendment-filter-list.service.ts | 7 +++++++ .../site/motions/services/motion-filter-list.service.ts | 8 ++++++-- 2 files changed, 13 insertions(+), 2 deletions(-) diff --git a/client/src/app/site/motions/services/amendment-filter-list.service.ts b/client/src/app/site/motions/services/amendment-filter-list.service.ts index a527861c5..6bd30bc19 100644 --- a/client/src/app/site/motions/services/amendment-filter-list.service.ts +++ b/client/src/app/site/motions/services/amendment-filter-list.service.ts @@ -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; + } } diff --git a/client/src/app/site/motions/services/motion-filter-list.service.ts b/client/src/app/site/motions/services/motion-filter-list.service.ts index c1c0e980f..aaaba3559 100644 --- a/client/src/app/site/motions/services/motion-filter-list.service.ts +++ b/client/src/app/site/motions/services/motion-filter-list.service.ts @@ -44,7 +44,7 @@ export class MotionFilterListService extends BaseFilterListService { /** * 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 { this.enabledWorkflows.motion = +id; }); + this.config.get('motions_amendments_workflow').subscribe(id => { + this.enabledWorkflows.amendment = +id; + }); + this.config.get('motions_statutes_enabled').subscribe(bool => { this.enabledWorkflows.statuteEnabled = bool; }); @@ -343,7 +347,7 @@ export class MotionFilterListService extends BaseFilterListService { }); } - private isWorkflowEnabled(workflowId: number): boolean { + protected isWorkflowEnabled(workflowId: number): boolean { return ( workflowId === this.enabledWorkflows.motion || (this.enabledWorkflows.statuteEnabled && workflowId === this.enabledWorkflows.statute)