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

[43146] Split screen persistent with empty state switching toggle from All to Unread (#10941)

Behrokh Satarnejad48a8bcdcbbb7
diff --git a/frontend/src/app/features/in-app-notifications/center/state/ian-center.service.ts b/frontend/src/app/features/in-app-notifications/center/state/ian-center.service.ts
index 874574dc740..09e66e6fe25 100644
--- a/frontend/src/app/features/in-app-notifications/center/state/ian-center.service.ts
+++ b/frontend/src/app/features/in-app-notifications/center/state/ian-center.service.ts
@@ -174,6 +174,8 @@ export class IanCenterService extends UntilDestroyedMixin {
public selectedNotificationIndex = 0;
+ public selectedNotification:INotification;
+
stateChanged$ = this.uiRouterGlobals.params$?.pipe(
this.untilDestroyed(),
pluck('workPackageId'),
@@ -198,7 +200,7 @@ export class IanCenterService extends UntilDestroyedMixin {
if (this.stateChanged$) {
this.stateChanged$.subscribe(() => {
- this.updateSelectedNotificationIndex();
+ this.updateSelectedNotification();
});
}
}
@@ -216,6 +218,12 @@ export class IanCenterService extends UntilDestroyedMixin {
this.onReload.pipe(take(1)).subscribe((collection) => {
this.store.update({ activeCollection: collection });
});
+
+ if (facet === 'unread') {
+ if (this.selectedNotification?.readIAN) {
+ this.goToCenter();
+ }
+ }
this.reload.next(true);
}
@@ -252,6 +260,11 @@ export class IanCenterService extends UntilDestroyedMixin {
);
}
+ goToCenter():void {
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access,@typescript-eslint/restrict-template-expressions
+ void this.state.go(this.state.current.data.baseRoute);
+ }
+
showNextNotification():void {
void this
.notifications$
@@ -351,7 +364,7 @@ export class IanCenterService extends UntilDestroyedMixin {
return promise;
}
- private updateSelectedNotificationIndex() {
+ private updateSelectedNotification() {
this
.notifications$
.pipe(
@@ -363,6 +376,7 @@ export class IanCenterService extends UntilDestroyedMixin {
if (notifications[i][0]._links.resource
&& idFromLink(notifications[i][0]._links.resource.href) === this.uiRouterGlobals.params.workPackageId) {
this.selectedNotificationIndex = i;
+ [this.selectedNotification] = notifications[i];
return;
}
}