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

[43122] Wrong html title while selecting filters in notification center (#11148)

Henriette Darge8495797571a4
diff --git a/frontend/src/app/features/in-app-notifications/center/in-app-notification-center-page.component.ts b/frontend/src/app/features/in-app-notifications/center/in-app-notification-center-page.component.ts
index eb3eb431fe9..8b2e4f4bf5e 100644
--- a/frontend/src/app/features/in-app-notifications/center/in-app-notification-center-page.component.ts
+++ b/frontend/src/app/features/in-app-notifications/center/in-app-notification-center-page.component.ts
@@ -100,7 +100,8 @@ export class InAppNotificationCenterPageComponent extends UntilDestroyedMixin im
ngOnInit():void {
this.documentReferer = document.referrer;
- this.titleService.prependFirstPart(this.text.title);
+
+ this.setInitialHtmlTitle();
this.removeTransitionSubscription = this.$transitions.onSuccess({}, ():any => {
this.titleService.setFirstPart(this.text.title);
@@ -131,4 +132,21 @@ export class InAppNotificationCenterPageComponent extends UntilDestroyedMixin im
// eslint-disable-next-line class-methods-use-this, @typescript-eslint/no-unused-vars
changeChangesFromTitle(val:string):void {
}
+
+ private setInitialHtmlTitle():void {
+ const currentTitleParts = this.titleService.titleParts;
+
+ // Prepend "Notifications" if only the application name is shown
+ if (currentTitleParts.length === 1) {
+ this.titleService.prependFirstPart(this.text.title);
+ }
+
+ // A click on the left side menu of the notification center newly triggers the center page (and thus the ngOnInit).
+ // So the transition hook only works for changing the content of the split screen but not when switching for example
+ // from "watched" to "mentioned".
+ // So we override the first part in this case to make sure that there is not the name of a WP is shown when there is no split screen visible.
+ if (currentTitleParts[0] !== this.text.title) {
+ this.titleService.setFirstPart(this.text.title);
+ }
+ }
}