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

Merge branch 'dev' into scrolling-issues-in-activity-tab

Behrokh Satarnejade99a551ac617
diff --cc frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-base.controller.ts
index 3ad616d2189,d34daf2c890..df8631e21c5
--- 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
@@@ -76,37 -81,26 +81,27 @@@ export class ActivityPanelBaseControlle
this.togglerText = this.text.commentsOnly;
}
- ngOnInit() {
- combineLatest([
- this
- .apiV3Service
- .work_packages
- .id(this.workPackageId)
- .requireAndStream()
- .pipe(this.untilDestroyed()),
- this
- .apiV3Service
- .notifications
- .facet(
- 'unread',
- {
- pageSize: NOTIFICATIONS_MAX_SIZE,
- filters: [
- ['resourceId', '=', [this.workPackageId]],
- ['resourceType', '=', ['WorkPackage']],
- ],
- },
- ),
- ])
- .subscribe(([wp, notificationCollection]) => {
- this.notifications = notificationCollection._embedded.elements;
+ ngOnInit():void {
+ this
+ .apiV3Service
+ .work_packages
+ .id(this.workPackageId)
+ .requireAndStream()
+ .pipe(this.untilDestroyed())
+ .subscribe((wp) => {
this.workPackage = wp;
- this.wpActivity.require(this.workPackage).then((activities:any) => {
+ void this.wpActivity.require(this.workPackage).then((activities:HalResource[]) => {
this.updateActivities(activities);
this.cdRef.detectChanges();
+ this.scrollToUnreadNotification();
});
});
+
+ this.ianService.setActiveFacet('unread');
+ this.ianService.setActiveFilters([
+ ['resourceId', '=', [this.workPackageId]],
+ ['resourceType', '=', ['WorkPackage']],
+ ]);
}
protected updateActivities(activities:HalResource[]) {
@@@ -138,28 -132,17 +133,36 @@@
.filter((activity:HalResource) => !!_.get(activity, 'comment.html'));
}
- protected hasUnreadNotification(activityHref:string):boolean {
- return !!this.notifications.find((notification) => notification._links.activity?.href === activityHref);
+ protected hasUnreadNotification(activityHref:string):Observable<boolean> {
+ return this
+ .ianService
+ .query
+ .unread$
+ .pipe(
+ map((notifications) => !!notifications.find((notification) => notification._links.activity?.href === activityHref)),
+ );
}
++
+ protected scrollToUnreadNotification():void {
+ // scroll to the unread notification only if there is no deep link
+ if (!(window.location.href.indexOf('activity#') > -1)) {
+ const unreadNotifications = document.querySelectorAll('[data-qa-selector="user-activity-bubble"]');
+ const unreadNotificationsLength = unreadNotifications?.length;
+ if (unreadNotificationsLength && this.notifications.length) {
+ if (this.reverse) {
+ unreadNotifications[unreadNotificationsLength - 1].classList.add('op-user-activity--unread-notification-bubble_scrolled');
+ unreadNotifications[unreadNotificationsLength - 1].scrollIntoView();
+ } else {
+ unreadNotifications[0].classList.add('op-user-activity--unread-notification-bubble_scrolled');
+ unreadNotifications[0].scrollIntoView();
+ }
+ }
+ }
+ }
+
- public toggleComments() {
+ public toggleComments():void {
++
this.onlyComments = !this.onlyComments;
this.updateActivities(this.unfilteredActivities);