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
Unset current project when going back to global
Oliver Günther39f5ebab12c3
diff --git a/frontend/src/app/core/current-project/current-project.service.ts b/frontend/src/app/core/current-project/current-project.service.tsindex 7d8b26e213c..454509c1136 100644--- a/frontend/src/app/core/current-project/current-project.service.ts+++ b/frontend/src/app/core/current-project/current-project.service.ts@@ -32,7 +32,9 @@ import { ApiV3Service } from 'core-app/core/apiv3/api-v3.service';@Injectable({ providedIn: 'root' })export class CurrentProjectService {- private current:{ id:string, identifier:string, name:string };+ private currentId:string|null = null;+ private currentName:string|null = null;+ private currentIdentifier:string|null = null;constructor(private PathHelper:PathHelperService,@@ -42,43 +44,35 @@ export class CurrentProjectService {}public get inProjectContext():boolean {- return this.current !== undefined;+ return this.currentId !== null;}public get path():string|null {- if (this.current) {- return this.PathHelper.projectPath(this.current.identifier);+ if (this.currentIdentifier) {+ return this.PathHelper.projectPath(this.currentIdentifier);}return null;}public get apiv3Path():string|null {- if (this.current) {- return this.apiV3Service.projects.id(this.current.id).toString();+ if (this.currentId) {+ return this.apiV3Service.projects.id(this.currentId).toString();}return null;}public get id():string|null {- return this.getCurrent('id');+ return this.currentId;}public get name():string|null {- return this.getCurrent('name');+ return this.currentName;}public get identifier():string|null {- return this.getCurrent('identifier');- }-- private getCurrent(key:'id'|'identifier'|'name') {- if (this.current && this.current[key]) {- return this.current[key].toString();- }-- return null;+ return this.currentIdentifier;}/**@@ -87,11 +81,13 @@ export class CurrentProjectService {public detect() {const element:HTMLMetaElement|null = document.querySelector('meta[name=current_project]');if (element) {- this.current = {- id: element.dataset.projectId!,- name: element.dataset.projectName!,- identifier: element.dataset.projectIdentifier!,- };+ this.currentId = element.dataset.projectId as string;+ this.currentName = element.dataset.projectName as string;+ this.currentIdentifier = element.dataset.projectIdentifier as string;+ } else {+ this.currentId = null;+ this.currentName = null;+ this.currentIdentifier = null;}}}diff --git a/spec/features/work_packages/cancel_editing_spec.rb b/spec/features/work_packages/cancel_editing_spec.rbindex bef64bedac7..7ae94862b6f 100644--- a/spec/features/work_packages/cancel_editing_spec.rb+++ b/spec/features/work_packages/cancel_editing_spec.rb@@ -62,9 +62,10 @@ RSpec.describe "Cancel editing work package", :js doenddef move_to_home_page(alert: true)- find(".op-logo--link").click+ accept_alert do+ find(".op-logo--link").click+ end- page.driver.browser.switch_to.alert.accept if alertexpect(page).to have_css("#projects-menu", text: "Select a project")end