diff --git a/Gemfile b/Gemfile index da66651b894b9865deb847928a1b5b9df9ae9417..d4c695e4565631f342b7872fc38618208aae9269 100644 --- a/Gemfile +++ b/Gemfile @@ -71,7 +71,7 @@ gem 'gollum-rugged_adapter', '~> 0.4.4', require: false gem 'github-linguist', '~> 4.7.0', require: 'linguist' # API -gem 'grape', '~> 0.19.0' +gem 'grape', '~> 0.19.2' gem 'grape-entity', '~> 0.6.0' gem 'rack-cors', '~> 0.4.0', require: 'rack/cors' diff --git a/Gemfile.lock b/Gemfile.lock index dfa7acc89174113dc1b7f2db6b737a4f7f16bff6..f6ec0ab54c9d74d5c86d3e35943082d484f2aae9 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -332,13 +332,13 @@ GEM multi_json (~> 1.11) os (~> 0.9) signet (~> 0.7) - grape (0.19.1) + grape (0.19.2) activesupport builder hashie (>= 2.1.0) multi_json (>= 1.3.2) multi_xml (>= 0.5.2) - mustermann-grape (~> 0.4.0) + mustermann-grape (~> 1.0.0) rack (>= 1.3.0) rack-accept virtus (>= 1.0.0) @@ -463,10 +463,9 @@ GEM multi_json (1.12.1) multi_xml (0.6.0) multipart-post (2.0.0) - mustermann (0.4.0) - tool (~> 0.2) - mustermann-grape (0.4.0) - mustermann (= 0.4.0) + mustermann (1.0.0) + mustermann-grape (1.0.0) + mustermann (~> 1.0.0) mysql2 (0.4.5) net-ldap (0.12.1) netrc (0.11.0) @@ -850,7 +849,6 @@ GEM timfel-krb5-auth (0.8.3) toml-rb (0.3.15) citrus (~> 3.0, > 3.0) - tool (0.2.3) truncato (0.7.8) htmlentities (~> 4.3.1) nokogiri (~> 1.6.1) @@ -981,7 +979,7 @@ DEPENDENCIES gollum-rugged_adapter (~> 0.4.4) gon (~> 6.1.0) google-api-client (~> 0.8.6) - grape (~> 0.19.0) + grape (~> 0.19.2) grape-entity (~> 0.6.0) haml_lint (~> 0.21.0) hamlit (~> 2.6.1) diff --git a/lib/api/access_requests.rb b/lib/api/access_requests.rb index c9b5f58c55796555bc8c0a9ba5b967b9b69cc747..cdacf9839e5559234da9448e1e4dfa7f6797a974 100644 --- a/lib/api/access_requests.rb +++ b/lib/api/access_requests.rb @@ -68,6 +68,7 @@ module API delete ":id/access_requests/:user_id" do source = find_source(source_type, params[:id]) + status 204 ::Members::DestroyService.new(source, current_user, params) .execute(:requesters) end diff --git a/lib/api/award_emoji.rb b/lib/api/award_emoji.rb index 56f19f89642f8b264f07d2097981a59ada37399d..5a028fc9d0bb7b2a21a5adf02564181d163de299 100644 --- a/lib/api/award_emoji.rb +++ b/lib/api/award_emoji.rb @@ -88,6 +88,7 @@ module API unauthorized! unless award.user == current_user || current_user.admin? + status 204 award.destroy end end diff --git a/lib/api/broadcast_messages.rb b/lib/api/broadcast_messages.rb index 395c401203c4aa3e216dcc24b30ace9ef68cf682..9980aec47525ee1f80d59a45a0eb9c8f0150aaa0 100644 --- a/lib/api/broadcast_messages.rb +++ b/lib/api/broadcast_messages.rb @@ -91,6 +91,7 @@ module API delete ':id' do message = find_message + status 204 message.destroy end end diff --git a/lib/api/deploy_keys.rb b/lib/api/deploy_keys.rb index d5c2f3d509448efc6dd9e4d23651db5632100a97..42e7c1486b0642d97e116ff72ca959d0f720d224 100644 --- a/lib/api/deploy_keys.rb +++ b/lib/api/deploy_keys.rb @@ -125,6 +125,7 @@ module API key = user_project.deploy_keys_projects.find_by(deploy_key_id: params[:key_id]) not_found!('Deploy Key') unless key + status 204 key.destroy end end diff --git a/lib/api/environments.rb b/lib/api/environments.rb index 945771d46f3b72758862cb2f47f460b5f3cf3d04..c774a5c668568ae2926fde95b8fa2288402b4ac3 100644 --- a/lib/api/environments.rb +++ b/lib/api/environments.rb @@ -79,6 +79,7 @@ module API environment = user_project.environments.find(params[:environment_id]) + status 204 environment.destroy end diff --git a/lib/api/groups.rb b/lib/api/groups.rb index ebbaed0cbb752790c77f76a3497ed1d6affe6388..49c3b2278c7f27c75270cdd37b5647e271edfa8a 100644 --- a/lib/api/groups.rb +++ b/lib/api/groups.rb @@ -125,6 +125,8 @@ module API delete ":id" do group = find_group!(params[:id]) authorize! :admin_group, group + + status 204 ::Groups::DestroyService.new(group, current_user).execute end diff --git a/lib/api/issues.rb b/lib/api/issues.rb index 64be08094ed40d1b45350b9434bc1d40fafe54b1..14b26f28ebfba27b2898403f346314dc063aafdb 100644 --- a/lib/api/issues.rb +++ b/lib/api/issues.rb @@ -224,6 +224,7 @@ module API not_found!('Issue') unless issue authorize!(:destroy_issue, issue) + status 204 issue.destroy end diff --git a/lib/api/labels.rb b/lib/api/labels.rb index 20b25529d0ca9a20dc8c659df8d29c1a9cae8efe..4520c98d951e30a78f0628877b646c13bafbdc43 100644 --- a/lib/api/labels.rb +++ b/lib/api/labels.rb @@ -56,6 +56,7 @@ module API label = user_project.labels.find_by(title: params[:name]) not_found!('Label') unless label + status 204 label.destroy end diff --git a/lib/api/members.rb b/lib/api/members.rb index c200e46a3282e1f8de5a74b5eb10c2a8ac08163c..bb970b7cd5492f213a1f3eb4d429f2c0e79ec197 100644 --- a/lib/api/members.rb +++ b/lib/api/members.rb @@ -96,6 +96,7 @@ module API # Ensure that memeber exists source.members.find_by!(user_id: params[:user_id]) + status 204 ::Members::DestroyService.new(source, current_user, declared_params).execute end end diff --git a/lib/api/merge_requests.rb b/lib/api/merge_requests.rb index ac33b2b801c0d7a56af3abf2305d34b997bbc96d..6e2e13e0a245f97076274e3c806df1cac3af1c3a 100644 --- a/lib/api/merge_requests.rb +++ b/lib/api/merge_requests.rb @@ -137,6 +137,7 @@ module API merge_request = find_project_merge_request(params[:merge_request_iid]) authorize!(:destroy_merge_request, merge_request) + status 204 merge_request.destroy end diff --git a/lib/api/notes.rb b/lib/api/notes.rb index 01ca62b593f5b158d03e5f8db88320bb22b775a2..65ff89edf657135a8836ec0ef2eaf1f21ad42e57 100644 --- a/lib/api/notes.rb +++ b/lib/api/notes.rb @@ -131,6 +131,7 @@ module API note = user_project.notes.find(params[:note_id]) authorize! :admin_note, note + status 204 ::Notes::DestroyService.new(user_project, current_user).execute(note) end end diff --git a/lib/api/project_hooks.rb b/lib/api/project_hooks.rb index 7a345289617aab0d0da0d917802bc904b624056d..649dd891f5614140bba6d2585047b69fd452703c 100644 --- a/lib/api/project_hooks.rb +++ b/lib/api/project_hooks.rb @@ -96,6 +96,7 @@ module API delete ":id/hooks/:hook_id" do hook = user_project.hooks.find(params.delete(:hook_id)) + status 204 hook.destroy end end diff --git a/lib/api/project_snippets.rb b/lib/api/project_snippets.rb index 3320eadff0d03ab11a5eccc7333d4fbc970c5c29..f3d905b0068f49b1620cdf32d02d0f19d8d5c6b3 100644 --- a/lib/api/project_snippets.rb +++ b/lib/api/project_snippets.rb @@ -116,6 +116,7 @@ module API not_found!('Snippet') unless snippet authorize! :admin_project_snippet, snippet + status 204 snippet.destroy end diff --git a/lib/api/projects.rb b/lib/api/projects.rb index c459257158de82f642b29b5f558f479f2a699465..89dda88d3f59341cfd29e427fb3ffaac8b48c1b8 100644 --- a/lib/api/projects.rb +++ b/lib/api/projects.rb @@ -361,6 +361,7 @@ module API authorize! :remove_fork_project, user_project if user_project.forked? + status 204 user_project.forked_project_link.destroy else not_modified! @@ -405,6 +406,7 @@ module API link = user_project.project_group_links.find_by(group_id: params[:group_id]) not_found!('Group Link') unless link + status 204 link.destroy end diff --git a/lib/api/runner.rb b/lib/api/runner.rb index 4552115b3e202401492c32da8c569b261d71df60..405d25ca3c13b17eefd344b6189099afe7fbe779 100644 --- a/lib/api/runner.rb +++ b/lib/api/runner.rb @@ -45,6 +45,7 @@ module API end delete '/' do authenticate_runner! + status 204 Ci::Runner.find_by_token(params[:token]).destroy end diff --git a/lib/api/runners.rb b/lib/api/runners.rb index db6c7c590929ad1ae9bd2b36d4f9d75147cd3009..5bf5a18e42f1e5d9315e91f397daff29c5033560 100644 --- a/lib/api/runners.rb +++ b/lib/api/runners.rb @@ -79,6 +79,7 @@ module API runner = get_runner(params[:id]) authenticate_delete_runner!(runner) + status 204 runner.destroy! end end @@ -134,6 +135,7 @@ module API runner = runner_project.runner forbidden!("Only one project associated with the runner. Please remove the runner instead") if runner.projects.count == 1 + status 204 runner_project.destroy end end diff --git a/lib/api/snippets.rb b/lib/api/snippets.rb index fd634037a7700f9c6643cbe867848814855c24fc..35ece56c65c7b997f75326323c521124272bc727 100644 --- a/lib/api/snippets.rb +++ b/lib/api/snippets.rb @@ -123,6 +123,7 @@ module API authorize! :destroy_personal_snippet, snippet + status 204 snippet.destroy end diff --git a/lib/api/system_hooks.rb b/lib/api/system_hooks.rb index ed7b23b474a702dc52172b2ed530dc34eb0eac8b..c0179037440f2c1e2e3093680bea7f4caf088351 100644 --- a/lib/api/system_hooks.rb +++ b/lib/api/system_hooks.rb @@ -66,6 +66,7 @@ module API hook = SystemHook.find_by(id: params[:id]) not_found!('System hook') unless hook + status 204 hook.destroy end end diff --git a/lib/api/triggers.rb b/lib/api/triggers.rb index a9f2ca2608ea526c3b395fa96daaaee5b9e53c01..cb0619105e1b0bb522043b4dfbcb70399a21e9ce 100644 --- a/lib/api/triggers.rb +++ b/lib/api/triggers.rb @@ -142,6 +142,7 @@ module API trigger = user_project.triggers.find(params.delete(:trigger_id)) return not_found!('Trigger') unless trigger + status 204 trigger.destroy end end diff --git a/lib/api/users.rb b/lib/api/users.rb index 81c68ea2658f1ff30d5cafb000a5212b989eb31c..a590f2692a294abf270b40e37c97e9fda330ed34 100644 --- a/lib/api/users.rb +++ b/lib/api/users.rb @@ -235,6 +235,7 @@ module API key = user.keys.find_by(id: params[:key_id]) not_found!('Key') unless key + status 204 key.destroy end @@ -306,6 +307,7 @@ module API user = User.find_by(id: params[:id]) not_found!('User') unless user + status 204 user.delete_async(deleted_by: current_user, params: params) end @@ -406,6 +408,7 @@ module API requires :impersonation_token_id, type: Integer, desc: 'The ID of the impersonation token' end delete ':impersonation_token_id' do + status 204 find_impersonation_token.revoke! end end @@ -483,6 +486,7 @@ module API key = current_user.keys.find_by(id: params[:key_id]) not_found!('Key') unless key + status 204 key.destroy end @@ -534,6 +538,7 @@ module API email = current_user.emails.find_by(id: params[:email_id]) not_found!('Email') unless email + status 204 Emails::DestroyService.new(current_user, email: email.email).execute end diff --git a/lib/api/variables.rb b/lib/api/variables.rb index 7fa528fb2d3d103bf47d5febe5655ef999e10921..7c0fdd3d1be42e64bbe6119bb51c36e2bfcb4baa 100644 --- a/lib/api/variables.rb +++ b/lib/api/variables.rb @@ -88,6 +88,7 @@ module API variable = user_project.variables.find_by(key: params[:key]) not_found!('Variable') unless variable + status 204 variable.destroy end end