From 74906f3dd8ec6084e56cc28523e59f7634a9837e Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Wed, 1 Mar 2017 13:59:15 +0100 Subject: 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. --- lib/api/commit_statuses.rb | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'lib/api/commit_statuses.rb') 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 -- cgit v1.2.1