diff options
author | Toon Claes <toon@gitlab.com> | 2019-02-28 19:57:34 +0100 |
---|---|---|
committer | Toon Claes <toon@gitlab.com> | 2019-02-28 19:57:34 +0100 |
commit | 62d7990b9bb30cf33ed87017c5c633d1cccc75c2 (patch) | |
tree | c3e1b69c58a412ba1c6f50a0337a23d9f9d6e1a4 /lib/api/subscriptions.rb | |
parent | f6453eca992a9c142268e78ac782cef98110d183 (diff) | |
download | gitlab-ce-tc-standard-gem.tar.gz |
Ran standardrb --fix on the whole codebasetc-standard-gem
Inspired by https://twitter.com/searls/status/1101137953743613952 I
decided to try https://github.com/testdouble/standard on our codebase.
It's opinionated, but at least it's a _standard_.
Diffstat (limited to 'lib/api/subscriptions.rb')
-rw-r--r-- | lib/api/subscriptions.rb | 28 |
1 files changed, 13 insertions, 15 deletions
diff --git a/lib/api/subscriptions.rb b/lib/api/subscriptions.rb index dfb54446ddf..c36e52cfd79 100644 --- a/lib/api/subscriptions.rb +++ b/lib/api/subscriptions.rb @@ -8,29 +8,29 @@ module API subscribables = [ { - type: 'merge_requests', + type: "merge_requests", entity: Entities::MergeRequest, source: Project, - finder: ->(id) { find_merge_request_with_access(id, :update_merge_request) } + finder: ->(id) { find_merge_request_with_access(id, :update_merge_request) }, }, { - type: 'issues', + type: "issues", entity: Entities::Issue, source: Project, - finder: ->(id) { find_project_issue(id) } + finder: ->(id) { find_project_issue(id) }, }, { - type: 'labels', + type: "labels", entity: Entities::ProjectLabel, source: Project, - finder: ->(id) { find_label(user_project, id) } + finder: ->(id) { find_label(user_project, id) }, }, { - type: 'labels', + type: "labels", entity: Entities::GroupLabel, source: Group, - finder: ->(id) { find_label(user_group, id) } - } + finder: ->(id) { find_label(user_group, id) }, + }, ] subscribables.each do |subscribable| @@ -38,10 +38,10 @@ module API params do requires :id, type: String, desc: "The #{source_type} ID" - requires :subscribable_id, type: String, desc: 'The ID of a resource' + requires :subscribable_id, type: String, desc: "The ID of a resource" end resource source_type.pluralize, requirements: API::NAMESPACE_OR_PROJECT_REQUIREMENTS do - desc 'Subscribe to a resource' do + desc "Subscribe to a resource" do success subscribable[:entity] end post ":id/#{subscribable[:type]}/:subscribable_id/subscribe" do @@ -56,7 +56,7 @@ module API end end - desc 'Unsubscribe from a resource' do + desc "Unsubscribe from a resource" do success subscribable[:entity] end post ":id/#{subscribable[:type]}/:subscribable_id/unsubscribe" do @@ -78,10 +78,8 @@ module API helpers do def parent_resource(source_type) case source_type - when 'project' + when "project" user_project - else - nil end end end |