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 viewpoint seeding in multitenancy

Oliver Günther800367a1d049
diff --git a/modules/bim/lib/open_project/bim/bcf_xml/issue_reader.rb b/modules/bim/lib/open_project/bim/bcf_xml/issue_reader.rb
index af682ac7646..5173221d2f6 100644
--- a/modules/bim/lib/open_project/bim/bcf_xml/issue_reader.rb
+++ b/modules/bim/lib/open_project/bim/bcf_xml/issue_reader.rb
@@ -186,17 +186,19 @@ module OpenProject::Bim::BcfXml
extractor.viewpoints.each do |vp|
next if issue.viewpoints.has_uuid?(vp[:uuid])
- issue.viewpoints.build(
+ viewpoint = issue.viewpoints.build(
issue:,
uuid: vp[:uuid],
# Save the viewpoint as json
json_viewpoint: viewpoint_as_json(vp[:uuid], read_entry(vp[:viewpoint])),
viewpoint_name: vp[:viewpoint],
-
- # Save the snapshot as file attachment
- snapshot: as_file_entry(vp[:snapshot])
)
+
+ # Save the snapshot as file attachment
+ file = as_file_entry(vp[:snapshot])
+ # Call build_snapshot manually so we can ensure the correct user is passed
+ viewpoint.build_snapshot(file, user:)
end
end