summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorKamil Trzciński <ayufan@ayufan.eu>2017-03-02 11:09:04 +0000
committerKamil Trzciński <ayufan@ayufan.eu>2017-03-02 11:09:04 +0000
commit598d2b20f855c141f9284ed69292110b511edd53 (patch)
treebba9432200692199be3db62668572c283bfd1fec /lib
parentd77bf0ed7153bbad192ad9d0bac67d5238e38b73 (diff)
parente19687b22480103d1a475ea8b56a3a36a0e77e1b (diff)
downloadgitlab-ce-598d2b20f855c141f9284ed69292110b511edd53.tar.gz
Merge branch 'fix/gb/update-commit-status-api' into 'master'
Fix updaing commit status when using optional attributes Closes #28656 and #25784 See merge request !9618
Diffstat (limited to 'lib')
-rw-r--r--lib/api/commit_statuses.rb9
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