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
address review remarks
Markus Kahl22a8424f94ff
diff --git a/modules/github_integration/app/models/deploy_target.rb b/modules/github_integration/app/models/deploy_target.rbindex 92563c45d8b..cb4d5942193 100644--- a/modules/github_integration/app/models/deploy_target.rb+++ b/modules/github_integration/app/models/deploy_target.rb@@ -34,7 +34,10 @@ class DeployTarget < ApplicationRecordhas_many :deploy_status_checks, dependent: :destroyvalidates_presence_of :host+ validates_uniqueness_of :host+validates_presence_of :type+# this is very much specific to the only type of target we support for now, OpenProjectvalidates_presence_of :api_keyenddiff --git a/modules/github_integration/app/workers/cron/check_deploy_status_job.rb b/modules/github_integration/app/workers/cron/check_deploy_status_job.rbindex b1ed86d3e32..1372811aa5d 100644--- a/modules/github_integration/app/workers/cron/check_deploy_status_job.rb+++ b/modules/github_integration/app/workers/cron/check_deploy_status_job.rb@@ -90,13 +90,13 @@ module Cronenddef delete_status_check(pull_request, deploy_target)- # we use `find` and delete it this way to also cover+ # we use `select` and delete it this way to also cover# not-yet-persisted records- check = pull_request+ checks = pull_request.deploy_status_checks- .find { |c| c.deploy_target == deploy_target }+ .select { |c| c.deploy_target == deploy_target }- pull_request.deploy_status_checks.delete(check)+ pull_request.deploy_status_checks.delete(checks)end##@@ -143,6 +143,16 @@ module Cronreturn false if data.nil?+ status_identical?(data) || status_behind?(data)+ end++ def status_identical?(data)+ status = data["status"].presence++ status == "identical"+ end++ def status_behind?(data)status = data["status"].presenceahead_by = data["ahead_by"].presencebehind_by = data["behind_by"].presencediff --git a/modules/github_integration/config/routes.rb b/modules/github_integration/config/routes.rbindex 7fe0aaba47a..2f6f23ab8f4 100644--- a/modules/github_integration/config/routes.rb+++ b/modules/github_integration/config/routes.rb@@ -27,5 +27,5 @@#++Rails.application.routes.draw do- resources :deploy_targets, only: %i[index new edit update create destroy]+ resources :deploy_targets, only: %i[index new create destroy]end