Merge pull request #6086 from tsiegleauq/motion-nop-nav-regress

Fix non existing top nav for motions
This commit is contained in:
Emanuel Schütze 2021-06-01 10:58:27 +02:00 committed by GitHub
commit 3a2773aa5d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -564,30 +564,25 @@ export class MotionDetailComponent extends BaseViewComponentDirective implements
this.statuteParagraphs = newViewStatuteParagraphs; this.statuteParagraphs = newViewStatuteParagraphs;
}); });
// use the filter and the search service to get the current sorting if (this.motion && this.motion.parent_id) {
if (this.configService.instant<boolean>('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) {
// only use the amendments for this motion // only use the amendments for this motion
this.amendmentFilterService.initFilters(this.repo.amendmentsTo(this.motion.parent_id)); this.amendmentFilterService.initFilters(this.repo.amendmentsTo(this.motion.parent_id));
this.amendmentSortService.initSorting(this.amendmentFilterService.outputObservable); this.amendmentSortService.initSorting(this.amendmentFilterService.outputObservable);
this.sortedMotionsObservable = this.amendmentSortService.outputObservable; this.sortedMotionsObservable = this.amendmentSortService.outputObservable;
} else { } 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.subscriptions.push(
this.sortedMotionsObservable.subscribe(motions => { this.sortedMotionsObservable?.subscribe(motions => {
if (motions) { if (motions) {
this.sortedMotions = motions; this.sortedMotions = motions;
this.setSurroundingMotions(); this.setSurroundingMotions();
} }
}) })
); );
}
/** /**
* Check for changes of the viewport subject changes * Check for changes of the viewport subject changes
@ -619,6 +614,7 @@ export class MotionDetailComponent extends BaseViewComponentDirective implements
if (navEvent instanceof NavigationEnd) { if (navEvent instanceof NavigationEnd) {
this.cleanSubjects(); this.cleanSubjects();
this.getMotionByUrl(); this.getMotionByUrl();
this.cd.markForCheck();
} }
}); });
} }