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 parent link not being reachable due to missing tabIdentifier

Oliver Günther56ded0495519
diff --git a/frontend/src/app/features/work-packages/components/wp-breadcrumb/wp-breadcrumb-parent.html b/frontend/src/app/features/work-packages/components/wp-breadcrumb/wp-breadcrumb-parent.html
index 4c02d51f939..8c3160f11ae 100644
--- a/frontend/src/app/features/work-packages/components/wp-breadcrumb/wp-breadcrumb-parent.html
+++ b/frontend/src/app/features/work-packages/components/wp-breadcrumb/wp-breadcrumb-parent.html
@@ -1,8 +1,8 @@
<ng-container *ngIf="!active">
<a *ngIf="parent"
[attr.title]="parent.name"
- uiSref="work-packages.show.tabs"
- [uiParams]="{workPackageId: parent.id}"
+ uiSref="work-packages.show"
+ [uiParams]="{ workPackageId: parent.id }"
class="op-wp-breadcrumb-parent nocut"
data-qa-selector="op-wp-breadcrumb-parent">
<span [textContent]="parent.name"></span>
diff --git a/frontend/src/app/features/work-packages/routing/work-packages-routes.ts b/frontend/src/app/features/work-packages/routing/work-packages-routes.ts
index 3bb1e5df6c8..6b37cc51f0f 100644
--- a/frontend/src/app/features/work-packages/routing/work-packages-routes.ts
+++ b/frontend/src/app/features/work-packages/routing/work-packages-routes.ts
@@ -36,6 +36,7 @@ import { WorkPackageListViewComponent } from 'core-app/features/work-packages/ro
import { WorkPackageViewPageComponent } from 'core-app/features/work-packages/routing/wp-view-page/wp-view-page.component';
import { makeSplitViewRoutes } from 'core-app/features/work-packages/routing/split-view-routes.template';
import { WorkPackageCopyFullViewComponent } from 'core-app/features/work-packages/components/wp-copy/wp-copy-full-view.component';
+import { KeepTabService } from 'core-app/features/work-packages/components/wp-single-view-tabs/keep-tab/keep-tab.service';
export const menuItemClass = 'work-packages-menu-item';
@@ -96,9 +97,11 @@ export const WORK_PACKAGES_ROUTES:Ng2StateDeclaration[] = [
// Redirect to 'activity' by default.
redirectTo: (trans) => {
const params = trans.params('to');
+ const keepTab = trans.injector().get(KeepTabService) as KeepTabService;
+ const tabIdentifier = keepTab.currentShowTab;
return {
state: 'work-packages.show.tabs',
- params: { ...params, tabIdentifier: 'activity' },
+ params: { ...params, tabIdentifier: tabIdentifier || 'activity' },
};
},
component: WorkPackagesFullViewComponent,
diff --git a/spec/features/notifications/navigation_spec.rb b/spec/features/notifications/navigation_spec.rb
index d5931b9b766..e2786962bac 100644
--- a/spec/features/notifications/navigation_spec.rb
+++ b/spec/features/notifications/navigation_spec.rb
@@ -1,7 +1,8 @@
require 'spec_helper'
describe "Notification center navigation", type: :feature, js: true do
- shared_let(:project) { create :project }
+ shared_association_default(:project) { create(:project) }
+
shared_let(:work_package) { create :work_package, project: }
shared_let(:second_work_package) { create :work_package, project: }
shared_let(:recipient) do
@@ -77,4 +78,33 @@ describe "Notification center navigation", type: :feature, js: true do
center.expect_item_selected notification
end
+
+ context 'if the work package has a parent' do
+ before do
+ work_package.update! parent: second_work_package
+ end
+
+ it 'can link to that parent from notifications (Regression #42984)' do
+ visit "/notifications/details/#{work_package.id}"
+
+ expect(page).to have_current_path "/notifications/details/#{work_package.id}/overview"
+
+ split_screen.expect_open
+
+ expect(page).to have_selector('[data-qa-selector="op-wp-breadcrumb-parent"]', text: second_work_package.subject)
+
+ page.find('[data-qa-selector="op-wp-breadcrumb-parent"]').click
+
+ expect(page).to have_current_path "/work_packages/#{second_work_package.id}/activity"
+
+ # Works with another tab as well
+ visit "/notifications/details/#{work_package.id}/relations"
+
+ expect(page).to have_current_path "/notifications/details/#{work_package.id}/relations"
+
+ page.find('[data-qa-selector="op-wp-breadcrumb-parent"]').click
+
+ expect(page).to have_current_path "/work_packages/#{second_work_package.id}/relations"
+ end
+ end
end