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
prevent 500 errors: undefined method `iid?` for nil:NilClass when pipeline_hook requested without merge_request
Aleksey Kurepind8cb06d9fdd0
diff --git a/lib/open_project/gitlab_integration/notification_handler/pipeline_hook.rb b/lib/open_project/gitlab_integration/notification_handler/pipeline_hook.rbindex 1c14b01fb17..c591e18957a 100644--- a/lib/open_project/gitlab_integration/notification_handler/pipeline_hook.rb+++ b/lib/open_project/gitlab_integration/notification_handler/pipeline_hook.rb@@ -37,14 +37,16 @@ module OpenProject::GitlabIntegrationdef process(payload_params)@payload = wrap_payload(payload_params)- return unless associated_with_mr?+ return if payload.merge_request.blank?+merge_request = find_merge_requestreturn unless merge_request+ return unless associated_with_mr?# disabled until gitlab issue resolutionOpenProject::GitlabIntegration::Services::UpsertPipeline.new.call(payload,- merge_request: merge_request+ merge_request:)end@@ -53,12 +55,12 @@ module OpenProject::GitlabIntegrationattr_reader :payloaddef associated_with_mr?- payload.merge_request.iid?.present?+ payload.merge_request.iid.present?enddef find_merge_requestgitlab_id = payload.merge_request.iid- GitlabMergeRequest.find_by(gitlab_id: gitlab_id)+ GitlabMergeRequest.find_by(gitlab_id:)endendend