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

Don't try to output link on new record

Oliver Güntherdf92416dd65b
diff --git a/lib/open_project/gitlab_integration/patches/api/work_package_representer.rb b/lib/open_project/gitlab_integration/patches/api/work_package_representer.rb
index de310797b95..37202bfd2d6 100644
--- a/lib/open_project/gitlab_integration/patches/api/work_package_representer.rb
+++ b/lib/open_project/gitlab_integration/patches/api/work_package_representer.rb
@@ -36,6 +36,8 @@ module OpenProject::GitlabIntegration
->(*) do
link :gitlab,
cache_if: -> { current_user.allowed_to?(:show_gitlab_content, represented.project) } do
+ next if represented.new_record?
+
{
href: "#{work_package_path(id: represented.id)}/tabs/gitlab",
title: "gitlab"
@@ -43,6 +45,8 @@ module OpenProject::GitlabIntegration
end
link :gitlab_merge_requests do
+ next if represented.new_record?
+
{
href: api_v3_paths.gitlab_merge_requests_by_work_package(represented.id),
title: "Gitlab merge requests"