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

scroll to the oldest unread notification and make space above the scrolled element

bsatarnejad6a6f2bf55ecc
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 d6d51dc67e7..bee373fe534 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
@@ -104,6 +104,7 @@ export class ActivityPanelBaseController extends UntilDestroyedMixin implements
this.wpActivity.require(this.workPackage).then((activities:any) => {
this.updateActivities(activities);
this.cdRef.detectChanges();
+ this.scrollToUnreadNotification();
});
});
}
@@ -141,6 +142,22 @@ export class ActivityPanelBaseController extends UntilDestroyedMixin implements
return !!this.notifications.find((notification) => notification._links.activity?.href === activityHref);
}
+ protected scrollToUnreadNotification() {
+ // scroll to the unread notification only if there is no deep link
+ if (!(window.location.href.indexOf("activity#") > -1)) {
+ let unreadNotifications = document.querySelectorAll('[data-qa-selector="user-activity-bubble"]');
+ let notificationsLength = unreadNotifications.length;
+ if (this.reverse) {
+ unreadNotifications[notificationsLength - 1].setAttribute("style", "scroll-margin-top: 200px;");
+ unreadNotifications[notificationsLength - 1].scrollIntoView();
+ }
+ else {
+ unreadNotifications[0].setAttribute("style", "scroll-margin-top: 200px;");
+ unreadNotifications[0].scrollIntoView();
+ }
+ }
+ }
+
public toggleComments() {
this.onlyComments = !this.onlyComments;
this.updateActivities(this.unfilteredActivities);