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

Restore setting the first part of title if it contains the full base

Oliver Günther2358f56cbf8e
diff --git a/frontend/src/app/core/html/op-title.service.ts b/frontend/src/app/core/html/op-title.service.ts
index e244597f396..2d8e8cd4833 100644
--- a/frontend/src/app/core/html/op-title.service.ts
+++ b/frontend/src/app/core/html/op-title.service.ts
@@ -8,13 +8,27 @@ export class OpTitleService {
constructor(private titleService:Title) {
}
+ public get current():string {
+ return this.titleService.getTitle();
+ }
+
public get base():string {
const appTitle = document.querySelector('meta[name=app_title]') as HTMLMetaElement;
return appTitle.content;
}
+ public get titleParts():string[] {
+ return this.current.split(titlePartsSeparator);
+ }
+
public setFirstPart(value:string) {
- const newTitle = [value, this.base].join(titlePartsSeparator);
- this.titleService.setTitle(newTitle);
+ if (this.current.includes(this.base) && this.current.includes(titlePartsSeparator)) {
+ const parts = this.titleParts;
+ parts[0] = value;
+ this.titleService.setTitle(parts.join(titlePartsSeparator));
+ } else {
+ const newTitle = [value, this.base].join(titlePartsSeparator);
+ this.titleService.setTitle(newTitle);
+ }
}
}