From be36a8a40f5d1d8b6bf8a7343af398adf7d45c87 Mon Sep 17 00:00:00 2001 From: Sean Date: Fri, 28 May 2021 14:10:54 +0200 Subject: [PATCH] Fix non existing top nav for motions fixes a regression where motions had no top-navigation anymore --- .../motion-detail/motion-detail.component.ts | 30 ++++++++----------- 1 file changed, 13 insertions(+), 17 deletions(-) diff --git a/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.ts b/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.ts index 01c7dc8b0..fc65248f4 100644 --- a/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.ts +++ b/client/src/app/site/motions/modules/motion-detail/components/motion-detail/motion-detail.component.ts @@ -564,30 +564,25 @@ export class MotionDetailComponent extends BaseViewComponentDirective implements this.statuteParagraphs = newViewStatuteParagraphs; }); - // use the filter and the search service to get the current sorting - if (this.configService.instant('motions_amendments_main_table')) { - this.motionFilterService.initFilters(this.motionObserver); - this.motionSortService.initSorting(this.motionFilterService.outputObservable); - this.sortedMotionsObservable = this.motionSortService.outputObservable; - } else if (this.motion && this.motion.parent_id) { + if (this.motion && this.motion.parent_id) { // only use the amendments for this motion this.amendmentFilterService.initFilters(this.repo.amendmentsTo(this.motion.parent_id)); this.amendmentSortService.initSorting(this.amendmentFilterService.outputObservable); this.sortedMotionsObservable = this.amendmentSortService.outputObservable; } else { - this.sortedMotions = []; + this.motionFilterService.initFilters(this.motionObserver); + this.motionSortService.initSorting(this.motionFilterService.outputObservable); + this.sortedMotionsObservable = this.motionSortService.outputObservable; } - if (this.sortedMotionsObservable) { - this.subscriptions.push( - this.sortedMotionsObservable.subscribe(motions => { - if (motions) { - this.sortedMotions = motions; - this.setSurroundingMotions(); - } - }) - ); - } + this.subscriptions.push( + this.sortedMotionsObservable?.subscribe(motions => { + if (motions) { + this.sortedMotions = motions; + this.setSurroundingMotions(); + } + }) + ); /** * Check for changes of the viewport subject changes @@ -619,6 +614,7 @@ export class MotionDetailComponent extends BaseViewComponentDirective implements if (navEvent instanceof NavigationEnd) { this.cleanSubjects(); this.getMotionByUrl(); + this.cd.markForCheck(); } }); }