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
Ruby agile-developmentangularbcfboardsbug-trackerganttgantt-chartifcissue-trackerjira-alternativekanbanopenprojectproduct-managementproject-managementproject-planningroadmaprubyscrumtimelineworkflows
support referencing project by identifier
as-op53337f54c785
diff --git a/app/models/work_package/exports/macros/attributes.rb b/app/models/work_package/exports/macros/attributes.rbindex fa979b5e4d5..4885c9ad355 100644--- a/app/models/work_package/exports/macros/attributes.rb+++ b/app/models/work_package/exports/macros/attributes.rb@@ -114,6 +114,7 @@ module WorkPackage::Exportsreturn msg_macro_error(I18n.t("export.macro.model_not_found", model: type)) unless type == "value"project = Project.visible(user).find_by(id:)+ project = Project.visible(user).find_by(identifier: id) if project.nil?if project.nil?return msg_macro_error(I18n.t("export.macro.resource_not_found", resource: "#{Project.name} #{id}"))enddiff --git a/app/models/work_package/pdf_export/markdown_field.rb b/app/models/work_package/pdf_export/markdown_field.rbindex b478d14278a..f5d45baa1dd 100644--- a/app/models/work_package/pdf_export/markdown_field.rb+++ b/app/models/work_package/pdf_export/markdown_field.rb@@ -54,9 +54,9 @@ module WorkPackage::PDFExport::MarkdownFielddocument = Markly.parse(markdown)document.walk do |node|if node.type == :html- node.string_content = apply_macro_html(node.string_content, work_package, formatter)+ node.string_content = apply_macro_html(node.string_content, work_package, formatter) || node.string_contentelsif node.type == :text- node.string_content = apply_macro_text(node.string_content, work_package, formatter)+ node.string_content = apply_macro_text(node.string_content, work_package, formatter) || node.string_contentendenddocument.to_markdown@@ -72,6 +72,8 @@ module WorkPackage::PDFExport::MarkdownFieldenddef apply_macro_html(html, work_package, formatter)+ return html unless formatter.applicable?(html)+doc = Nokogiri::HTML.fragment(html)apply_macro_html_node(doc, work_package, formatter)doc.to_htmldiff --git a/spec/models/work_packages/pdf_export/work_package_to_pdf_spec.rb b/spec/models/work_packages/pdf_export/work_package_to_pdf_spec.rbindex 9a703b1fb54..6078c2c6378 100644--- a/spec/models/work_packages/pdf_export/work_package_to_pdf_spec.rb+++ b/spec/models/work_packages/pdf_export/work_package_to_pdf_spec.rb@@ -72,6 +72,7 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageToPdf doname: "Forbidden project",types: [type],id: 666,+ identifier: "forbidden-project",public: false,status_code: "on_track",active: true,@@ -370,10 +371,15 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageToPdf doprojectLabel:status```+ Project by identifier:+ projectValue:"#{project.identifier}":active+Project not found:projectValue:1234567890:activeAccess denied:projectValue:#{forbidden_project.id}:active+ Access denied by identifier:+ projectValue:"#{forbidden_project.identifier}":activeDESCRIPTIONendit "contains resolved attributes and labels" do@@ -397,14 +403,16 @@ RSpec.describe WorkPackage::PDFExport::WorkPackageToPdf do"1", export_time_formatted, project.name,+ "Project by identifier:", " ", I18n.t(:general_text_Yes),"Project not found: ","[#{I18n.t('export.macro.error', message:I18n.t('export.macro.resource_not_found', resource: "Project 1234567890"))}] ","Access denied: ","[#{I18n.t('export.macro.error', message:- I18n.t('export.macro.resource_not_found', resource: "Project #{forbidden_project.id}"))}]",+ I18n.t('export.macro.resource_not_found', resource: "Project #{forbidden_project.id}"))}] ",+ "Access denied by identifier:", " ", "[Macro error, resource not found: Project", "forbidden-project]",- "2", export_time_formatted, project.name,+ "2", export_time_formatted, project.name,].flattenexpect(result.join(" ")).to eq(expected_result.join(" "))end