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
Fix project API paths in project SQL representer in relative URL root
Oliver Günther0ab3eeae8ab4
diff --git a/lib/api/v3/projects/project_sql_representer.rb b/lib/api/v3/projects/project_sql_representer.rbindex f5552bde2b1..d1baf9be62f 100644--- a/lib/api/v3/projects/project_sql_representer.rb+++ b/lib/api/v3/projects/project_sql_representer.rb@@ -77,7 +77,7 @@ module API<<-SQL.squishCASEWHEN ancestors.id IS NOT NULL- THEN json_build_object('href', format('/api/v3/projects/%s', ancestors.id),+ THEN json_build_object('href', format('#{api_v3_paths.project('%s')}', ancestors.id),'title', ancestors.name)ELSE NULLEND@@ -86,7 +86,7 @@ module API<<-SQL.squishCASEWHEN ancestors.id IS NOT NULL AND ancestors.id IN (SELECT id FROM visible_projects)- THEN json_build_object('href', format('/api/v3/projects/%s', ancestors.id),+ THEN json_build_object('href', format('#{api_v3_paths.project('%s')}', ancestors.id),'title', ancestors.name)WHEN ancestors.id IS NOT NULL AND ancestors.id NOT IN (SELECT id FROM visible_projects)THEN json_build_object('href', '#{API::V3::URN_UNDISCLOSED}',diff --git a/spec/lib/api/v3/projects/project_sql_representer_rendering_spec.rb b/spec/lib/api/v3/projects/project_sql_representer_rendering_spec.rbindex b704eb44904..57f88eefa5e 100644--- a/spec/lib/api/v3/projects/project_sql_representer_rendering_spec.rb+++ b/spec/lib/api/v3/projects/project_sql_representer_rendering_spec.rb@@ -155,6 +155,28 @@ describe ::API::V3::Projects::ProjectSqlRepresenter, 'rendering' do)end+ context 'with relative url root', with_config: { rails_relative_url_root: '/foobar' } do+ it 'renders correctly' do+ expect(json)+ .to be_json_eql(+ {+ _links: {+ ancestors: [+ {+ href: "/foobar/api/v3/projects/#{grandparent.id}",+ title: grandparent.name+ },+ {+ href: API::V3::URN_UNDISCLOSED,+ title: I18n.t(:'api_v3.undisclosed.ancestor')+ }+ ]+ }+ }.to_json+ )+ end+ end+context 'when in a foreign language with single quotes in the translation hint text' dobefore doI18n.locale = :fr