Skip to content

Commit

Permalink
fix queue validation
Browse files Browse the repository at this point in the history
  • Loading branch information
bastelfreak committed Jun 29, 2020
1 parent ea72af4 commit f84300b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .rubocop_todo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Metrics/BlockLength:
# Offense count: 2
# Configuration parameters: CountComments.
Metrics/ClassLength:
Max: 123
Max: 129

# Offense count: 1
# Configuration parameters: IgnoredMethods.
Expand Down
10 changes: 8 additions & 2 deletions app/models/pull_request.rb
Original file line number Diff line number Diff line change
Expand Up @@ -176,8 +176,14 @@ def validate(saved_changes)
# validate() might use update() to change attributes which would trigger a new job
# To prevent loops, we filter `saved_changed` of those attributes and won't create new job if those are the only changed attributes
def queue_validation
attributes = %w[eligible_for_merge_comment eligible_for_ci_comment]
return unless (saved_changes.stringify_keys.keys & attributes).empty?
case saved_changes.stringify_keys.keys.sort
when %w[eligible_for_merge_comment eligible_for_ci_comment].sort
return
when %w[eligible_for_ci_comment]
return
when %w[eligible_for_merge_comment]
return
end

ValidatePullRequestWorker.perform_async(id, saved_changes)
end
Expand Down

0 comments on commit f84300b

Please sign in to comment.