Merge pull request #9736 from opf/fix/39021/prevent-scrolling-after-first-load

[39021] Prevent scrolling to a notification after initial load
pull/9747/head
Henriette Darge 3 years ago committed by GitHub
commit 1b1e6fc98f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 24
      frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-base.controller.ts

@ -86,6 +86,8 @@ export class ActivityPanelBaseController extends UntilDestroyedMixin implements
}
ngOnInit():void {
let initialized = false;
this
.apiV3Service
.work_packages
@ -97,17 +99,25 @@ export class ActivityPanelBaseController extends UntilDestroyedMixin implements
void this.wpActivity.require(this.workPackage).then((activities:HalResource[]) => {
this.updateActivities(activities);
this.cdRef.detectChanges();
this.storeService.query.hasNotifications$
.pipe(take(1))
.subscribe((hasNotification) => {
if (hasNotification) {
this.scrollToUnreadNotification();
}
});
if (!initialized) {
initialized = true;
this.scrollIfNotificationPresent();
}
});
});
}
private scrollIfNotificationPresent() {
this.storeService.query.hasNotifications$
.pipe(take(1))
.subscribe((hasNotification) => {
if (hasNotification) {
this.scrollToUnreadNotification();
}
});
}
protected updateActivities(activities:HalResource[]) {
this.unfilteredActivities = activities;

Loading…
Cancel
Save