Skip to content

OpenProject is the leading open source project management software for product, project and portfolio management. A powerful Jira alternative with agile planning, issue tracking, roadmaps, Gantt charts, time tracking, collaboration features, and more. Available on premises or in the cloud. ⭐ Star us on GitHub

[39021] Prevent scrolling to a notification after initial load

Oliver Günther57cd1a9d2296
diff --git a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-base.controller.ts b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-base.controller.ts
index f538eba51a9..e771d64dadd 100644
--- a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-base.controller.ts
+++ b/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;