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

Move the repeated v3_paths line into its own method

Marcello Rochac59c182c870c
diff --git a/lib/open_project/object_linking.rb b/lib/open_project/object_linking.rb
index 4cc04444ee6..2dc213bceea 100644
--- a/lib/open_project/object_linking.rb
+++ b/lib/open_project/object_linking.rb
@@ -146,9 +146,6 @@ module OpenProject
end
def url_to_attachment(attachment, only_path: true)
- # Including the module breaks the application in strange and mysterious ways
- v3_paths = API::V3::Utilities::PathHelper::ApiV3Path
-
if only_path
v3_paths.attachment_content(attachment.id)
else
@@ -157,13 +154,16 @@ module OpenProject
end
def url_to_file_link(file_link, only_path: true)
- v3_paths = API::V3::Utilities::PathHelper::ApiV3Path
-
if only_path
v3_paths.file_link_open(file_link.id)
else
v3_paths.url_for(:file_link_open, file_link.id)
end
end
+
+ def v3_paths
+ # Including the module breaks the application in strange and mysterious ways
+ API::V3::Utilities::PathHelper::ApiV3Path
+ end
end
end