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

Correctly highlight currently selected notification

Henriette Dargeb62a01a1a1ca
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.html
index 2fc8f233a87..892942591bd 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
@@ -14,12 +14,12 @@
class="op-ian-item"
[class.op-ian-item_expanded]="records[0].expanded"
[class.op-ian-item_read]="records[0].readIAN === true"
- [class.op-ian-item_selected]="(stateChanged$ | async) === records[0]._links.resource.href"
+ [class.op-ian-item_selected]="(stateChanged$ | async) === idFromLink(records[0]._links.resource.href)"
[notification]="records[0]"
[aggregatedNotifications]="records"
attr.data-test-selector="op-ian-notification-item-{{records[0].id}}"
[attr.data-qa-ian-read]="records[0].readIAN === true || undefined"
- [attr.data-qa-ian-selected]="(stateChanged$ | async) === records[0]._links.resource.href"
+ [attr.data-qa-ian-selected]="(stateChanged$ | async) === idFromLink(records[0]._links.resource.href)"
></op-in-app-notification-entry>
</cdk-virtual-scroll-viewport>
</ng-container>
@@ -28,7 +28,7 @@
<img [src]="image.no_notification" class="op-ian-center-loading-image"/>
<p class="op-ian-center-loading-text">
<span [textContent]="noNotificationText((totalCount$ | async) > 0)"></span>
-
+
</p>
<span
*ngIf="(totalCount$ | async) > 0"
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.ts
index f94b742187f..69bf6250daf 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
@@ -40,6 +40,7 @@ import { PathHelperService } from 'core-app/core/path-helper/path-helper.service
import { IanBellService } from 'core-app/features/in-app-notifications/bell/state/ian-bell.service';
import { imagePath } from 'core-app/shared/helpers/images/path-helper';
import { UrlParamsService } from 'core-app/core/url-params/url-params.service';
+import idFromLink from 'core-app/features/hal/helpers/id-from-link';
@Component({
templateUrl: './in-app-notification-center.component.html',
@@ -131,6 +132,8 @@ export class InAppNotificationCenterComponent implements OnInit {
},
};
+ protected readonly idFromLink = idFromLink;
+
constructor(
readonly cdRef:ChangeDetectorRef,
readonly elementRef:ElementRef,
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 bf3129558e0..0be6bd5d877 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
@@ -179,7 +179,7 @@ export class IanCenterService extends UntilDestroyedMixin {
public selectedNotification:INotification;
- stateChanged$ = of(this.urlParams.pathMatching(/\/details\/\d+/));
+ stateChanged$ = of(this.urlParams.pathMatching(/\/details\/(\d+)/));
constructor(
readonly I18n:I18nService,
@@ -356,7 +356,7 @@ export class IanCenterService extends UntilDestroyedMixin {
}
private updateSelectedNotification() {
- this
+ void this
.notifications$
.pipe(
take(1),