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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
Aggregate notifications
Oliver Günthere115ef8f1034
diff --git a/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.html b/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.htmlindex 23e9df22cca..828486f04bf 100644--- a/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.html+++ b/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.html@@ -6,9 +6,10 @@class="op-ian-center--viewport"><op-in-app-notification-entry- *cdkVirtualFor="let item of notifications$ | async; templateCacheSize: 0"+ *cdkVirtualFor="let records of notifications$ | async; templateCacheSize: 0"class="op-ian-center--entry"- [notification]="item"+ [notification]="records[0]"+ [aggregatedNotifications]="records"(resourceLinkClicked)="openSplitView($event)"></op-in-app-notification-entry></cdk-virtual-scroll-viewport>diff --git a/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.ts b/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.tsindex 33fe6e1d8ec..db1cb1f8f13 100644--- a/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.ts+++ b/frontend/src/app/features/in-app-notifications/center/in-app-notification-center.component.ts@@ -23,7 +23,12 @@ import { UIRouterGlobals } from '@uirouter/core';export class InAppNotificationCenterComponent implements OnInit {activeFacet$ = this.ianQuery.activeFacet$;- notifications$ = this.ianQuery.selectAll();+ notifications$ = this+ .ianQuery+ .aggregatedNotifications$+ .pipe(+ map((items) => Object.values(items)),+ );notificationsCount$ = this.ianQuery.selectCount();@@ -41,6 +46,8 @@ export class InAppNotificationCenterComponent implements OnInit {facets:string[] = ['unread', 'all'];+ originalOrder = ():number => 0;+text = {title: this.I18n.t('js.notifications.title'),button_close: this.I18n.t('js.button_close'),diff --git a/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.ts b/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.tsindex f72ebac6d9c..5fd54791943 100644--- a/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.ts+++ b/frontend/src/app/features/in-app-notifications/entry/in-app-notification-entry.component.ts@@ -24,6 +24,7 @@ import { PathHelperService } from 'core-app/core/path-helper/path-helper.service})export class InAppNotificationEntryComponent implements OnInit {@Input() notification:InAppNotification;+ @Input() aggregatedNotifications:InAppNotification[];@Output() resourceLinkClicked = new EventEmitter<unknown>();diff --git a/frontend/src/app/features/in-app-notifications/store/in-app-notifications.query.ts b/frontend/src/app/features/in-app-notifications/store/in-app-notifications.query.tsindex 909828e8e1a..56fd2e597c5 100644--- a/frontend/src/app/features/in-app-notifications/store/in-app-notifications.query.ts+++ b/frontend/src/app/features/in-app-notifications/store/in-app-notifications.query.ts@@ -1,10 +1,24 @@import { Injectable } from '@angular/core';import { QueryEntity } from '@datorama/akita';import { map } from 'rxjs/operators';-import { InAppNotificationsStore, InAppNotificationsState } from './in-app-notifications.store';+import { Observable } from 'rxjs';+import {+ InAppNotificationsState,+ InAppNotificationsStore,+} from './in-app-notifications.store';+import { InAppNotification } from 'core-app/features/in-app-notifications/store/in-app-notification.model';@Injectable({ providedIn: 'root' })export class InAppNotificationsQuery extends QueryEntity<InAppNotificationsState> {+ /** Notifications grouped by resource */+ aggregatedNotifications$:Observable<{ [key:string]:InAppNotification[] }> = this+ .selectAll()+ .pipe(+ map((notifications) => (+ _.groupBy(notifications, (notification) => notification._links.resource?.href || 'none')+ )),+ );+/** Get the number of unread items */unreadCount$ = this.select('unreadCount');