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

Fix accessing work package id with hash id

Oliver Günther502841918d35
diff --git a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-base.controller.ts b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-base.controller.ts
index d34daf2c890..ef061975cb5 100644
--- a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-base.controller.ts
+++ b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-base.controller.ts
@@ -26,8 +26,12 @@
// See docs/COPYRIGHT.rdoc for more details.
//++
-import { ChangeDetectorRef, Directive, OnInit } from '@angular/core';
-import { Transition } from '@uirouter/core';
+import {
+ ChangeDetectorRef,
+ Directive,
+ OnInit,
+} from '@angular/core';
+import { UIRouterGlobals } from '@uirouter/core';
import { WorkPackageResource } from 'core-app/features/hal/resources/work-package-resource';
import { HalResource } from 'core-app/features/hal/resources/hal-resource';
import { ActivityEntryInfo } from 'core-app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-entry-info';
@@ -71,7 +75,7 @@ export class ActivityPanelBaseController extends UntilDestroyedMixin implements
readonly apiV3Service:APIV3Service,
readonly I18n:I18nService,
readonly cdRef:ChangeDetectorRef,
- readonly $transition:Transition,
+ readonly uiRouterGlobals:UIRouterGlobals,
readonly wpActivity:WorkPackagesActivityService,
readonly ianService:InAppNotificationsService,
) {
diff --git a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-tab.component.ts b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-tab.component.ts
index 007282fe797..0c2b57fc0d0 100644
--- a/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-tab.component.ts
+++ b/frontend/src/app/features/work-packages/components/wp-single-view-tabs/activity-panel/activity-tab.component.ts
@@ -43,7 +43,8 @@ export class WorkPackageActivityTabComponent extends ActivityPanelBaseController
public trackByHref = trackByHrefAndProperty('version');
ngOnInit() {
- this.workPackageId = this.$transition.params('to').workPackageId;
+ const { workPackageId } = this.uiRouterGlobals.params as unknown as { workPackageId:string };
+ this.workPackageId = workPackageId;
super.ngOnInit();
}
}
diff --git a/frontend/src/app/features/work-packages/components/wp-tabs/components/wp-tab-wrapper/wp-tab-wrapper.component.ts b/frontend/src/app/features/work-packages/components/wp-tabs/components/wp-tab-wrapper/wp-tab-wrapper.component.ts
index 254819f2185..24ef06c8a73 100644
--- a/frontend/src/app/features/work-packages/components/wp-tabs/components/wp-tab-wrapper/wp-tab-wrapper.component.ts
+++ b/frontend/src/app/features/work-packages/components/wp-tabs/components/wp-tab-wrapper/wp-tab-wrapper.component.ts
@@ -26,8 +26,11 @@
// See docs/COPYRIGHT.rdoc for more details.
// ++
-import { Transition } from '@uirouter/core';
-import { Component, OnInit } from '@angular/core';
+import { UIRouterGlobals } from '@uirouter/core';
+import {
+ Component,
+ OnInit,
+} from '@angular/core';
import { I18nService } from 'core-app/core/i18n/i18n.service';
import { APIV3Service } from 'core-app/core/apiv3/api-v3.service';
import { Observable } from 'rxjs';
@@ -48,12 +51,13 @@ export class WpTabWrapperComponent implements OnInit {
tab:WpTabDefinition | undefined;
}>;
- get workPackageId() {
- return (this.$transition.params('to').workPackageId);
+ get workPackageId():string {
+ const { workPackageId } = this.uiRouterGlobals.params as unknown as { workPackageId:string };
+ return workPackageId;
}
constructor(readonly I18n:I18nService,
- readonly $transition:Transition,
+ readonly uiRouterGlobals:UIRouterGlobals,
readonly apiV3Service:APIV3Service,
readonly wpTabsService:WorkPackageTabsService) {}
@@ -72,7 +76,7 @@ export class WpTabWrapperComponent implements OnInit {
}
findTab(workPackage:WorkPackageResource):WpTabDefinition | undefined {
- const { tabIdentifier } = this.$transition.params('to');
+ const { tabIdentifier } = this.uiRouterGlobals.params as unknown as { tabIdentifier:string };
return this.wpTabsService.getTab(tabIdentifier, workPackage);
}