diff options
author | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-03-01 15:59:15 +0300 |
---|---|---|
committer | Grzegorz Bizon <grzesiek.bizon@gmail.com> | 2017-03-01 15:59:15 +0300 |
commit | 74906f3dd8ec6084e56cc28523e59f7634a9837e (patch) | |
tree | 4dc0eb1515de7832f0fde6d02b9f23f27b43f1aa /lib/api/commit_statuses.rb | |
parent | 48d7ed63912053a2a20f4352b7119ce267eb06fa (diff) |
Fix updaing commit status with optional attributes
Passing different optional attributes in case of updating an existing
commit status should not create a new commit status with the same name.
Diffstat (limited to 'lib/api/commit_statuses.rb')
-rw-r--r-- | lib/api/commit_statuses.rb | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/lib/api/commit_statuses.rb b/lib/api/commit_statuses.rb index dba0831664c..9d9f82fdb83 100644 --- a/lib/api/commit_statuses.rb +++ b/lib/api/commit_statuses.rb @@ -72,14 +72,15 @@ module API status = GenericCommitStatus.running_or_pending.find_or_initialize_by( project: @project, pipeline: pipeline, - user: current_user, name: name, ref: ref, - target_url: params[:target_url], - description: params[:description], - coverage: params[:coverage] + user: current_user ) + optional_attributes = + attributes_for_keys(%w[target_url description coverage]) + + status.update(optional_attributes) if optional_attributes.any? render_validation_error!(status) if status.invalid? begin |