Fix parent link not being reachable due to missing tabIdentifier

https://community.openproject.org/wp/42984
pull/10913/head
Oliver Günther 2 years ago
parent 297e237d68
commit 56ded04955
No known key found for this signature in database
GPG Key ID: A3A8BDAD7C0C552C
  1. 4
      frontend/src/app/features/work-packages/components/wp-breadcrumb/wp-breadcrumb-parent.html
  2. 5
      frontend/src/app/features/work-packages/routing/work-packages-routes.ts
  3. 32
      spec/features/notifications/navigation_spec.rb

@ -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>

@ -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,

@ -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

Loading…
Cancel
Save