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

Go to the viewpoint project when the viewpoint is listed on a parent project

Aleix Suau5fbbc2e5c6cb
diff --git a/frontend/src/app/modules/bim/bcf/bcf-wp-attribute-group/bcf-wp-attribute-group.component.ts b/frontend/src/app/modules/bim/bcf/bcf-wp-attribute-group/bcf-wp-attribute-group.component.ts
index 9a2df9e2690..bedef95c86e 100644
--- a/frontend/src/app/modules/bim/bcf/bcf-wp-attribute-group/bcf-wp-attribute-group.component.ts
+++ b/frontend/src/app/modules/bim/bcf/bcf-wp-attribute-group/bcf-wp-attribute-group.component.ts
@@ -150,7 +150,7 @@ export class BcfWpAttributeGroupComponent extends UntilDestroyedMixin implements
this.viewerBridge.showViewpoint(data);
} else {
window.location.href = this.pathHelper.bimDetailsPath(
- this.currentProject.identifier!,
+ this.workPackage.project.identifier,
this.workPackage.id!,
index
);
diff --git a/modules/bim/spec/features/viewer/show_viewpoint_spec.rb b/modules/bim/spec/features/viewer/show_viewpoint_spec.rb
index 2cdc76612db..ffb0bd89d14 100644
--- a/modules/bim/spec/features/viewer/show_viewpoint_spec.rb
+++ b/modules/bim/spec/features/viewer/show_viewpoint_spec.rb
@@ -32,7 +32,12 @@ describe 'Show viewpoint in model viewer',
with_config: { edition: 'bim' },
type: :feature,
js: true do
- let(:project) { FactoryBot.create :project, enabled_module_names: [:bim, :work_package_tracking] }
+ let(:project) do
+ FactoryBot.create(:project,
+ enabled_module_names: [:bim, :work_package_tracking],
+ parent: parent_project)
+ end
+ let(:parent_project) { nil }
let(:user) { FactoryBot.create :admin }
let!(:work_package) { FactoryBot.create(:work_package, project: project) }
@@ -94,14 +99,30 @@ describe 'Show viewpoint in model viewer',
context 'when in work packages details view' do
let(:wp_details) { ::Pages::SplitWorkPackage.new(work_package, project) }
+
+ shared_examples "moves to the BCF page" do
+ it 'moves to the bcf page' do
+ wp_details.visit!
+ bcf_details.expect_viewpoint_count 1
+ bcf_details.show_current_viewpoint
- it 'moves to the bcf page' do
- wp_details.visit!
- bcf_details.expect_viewpoint_count 1
- bcf_details.show_current_viewpoint
+ path = Regexp.escape("bcf/split/details/#{work_package.id}/overview")
+ expect(page).to have_current_path /#{path}/
+
+ project_identifier = Regexp.escape(project.identifier)
+ expect(page).to have_current_path /#{project_identifier}/
+ end
+ end
+
+ context "current project is the work package's project" do
+ it_behaves_like 'moves to the BCF page'
+ end
+
+ context "current project is a parent of the work package's project" do
+ let(:parent_project) { FactoryBot.create :project, enabled_module_names: [:work_package_tracking] }
+ let(:wp_details) { ::Pages::SplitWorkPackage.new(work_package, parent_project) }
- path = Regexp.escape("bcf/split/details/#{work_package.id}/overview")
- expect(page).to have_current_path /#{path}/
+ it_behaves_like "moves to the BCF page"
end
context 'when user only has view_linked_issues permission' do