summaryrefslogtreecommitdiff
path: root/app/serializers
diff options
context:
space:
mode:
authorGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-05-03 12:32:39 +0200
committerGrzegorz Bizon <grzesiek.bizon@gmail.com>2017-05-03 12:32:39 +0200
commit72307940bb04d29dc751adb5e76330d2ce45e9ce (patch)
treee7a3441115e60118d428999aed6164b782a213a3 /app/serializers
parent738bf2c23891467dbc9c74d08223fd3c4e432ae7 (diff)
downloadgitlab-ce-72307940bb04d29dc751adb5e76330d2ce45e9ce.tar.gz
Improve code style related to protected actions
Diffstat (limited to 'app/serializers')
-rw-r--r--app/serializers/build_action_entity.rb2
-rw-r--r--app/serializers/build_entity.rb4
-rw-r--r--app/serializers/pipeline_entity.rb6
3 files changed, 6 insertions, 6 deletions
diff --git a/app/serializers/build_action_entity.rb b/app/serializers/build_action_entity.rb
index 0bb7e561073..3eff724ae91 100644
--- a/app/serializers/build_action_entity.rb
+++ b/app/serializers/build_action_entity.rb
@@ -19,6 +19,6 @@ class BuildActionEntity < Grape::Entity
alias_method :build, :object
def playable?
- can?(request.user, :play_build, build) && build.playable?
+ build.playable? && can?(request.user, :play_build, build)
end
end
diff --git a/app/serializers/build_entity.rb b/app/serializers/build_entity.rb
index f301900c43c..10ba7c90c10 100644
--- a/app/serializers/build_entity.rb
+++ b/app/serializers/build_entity.rb
@@ -12,7 +12,7 @@ class BuildEntity < Grape::Entity
path_to(:retry_namespace_project_build, build)
end
- expose :play_path, if: proc { playable? } do |build|
+ expose :play_path, if: -> (*) { playable? } do |build|
path_to(:play_namespace_project_build, build)
end
@@ -26,7 +26,7 @@ class BuildEntity < Grape::Entity
alias_method :build, :object
def playable?
- can?(request.user, :play_build, build) && build.playable?
+ build.playable? && can?(request.user, :play_build, build)
end
def detailed_status
diff --git a/app/serializers/pipeline_entity.rb b/app/serializers/pipeline_entity.rb
index ad8b4d43e8f..7eb7aac72eb 100644
--- a/app/serializers/pipeline_entity.rb
+++ b/app/serializers/pipeline_entity.rb
@@ -48,15 +48,15 @@ class PipelineEntity < Grape::Entity
end
expose :commit, using: CommitEntity
- expose :yaml_errors, if: ->(pipeline, _) { pipeline.has_yaml_errors? }
+ expose :yaml_errors, if: -> (pipeline, _) { pipeline.has_yaml_errors? }
- expose :retry_path, if: proc { can_retry? } do |pipeline|
+ expose :retry_path, if: -> (*) { can_retry? } do |pipeline|
retry_namespace_project_pipeline_path(pipeline.project.namespace,
pipeline.project,
pipeline.id)
end
- expose :cancel_path, if: proc { can_cancel? } do |pipeline|
+ expose :cancel_path, if: -> (*) { can_cancel? } do |pipeline|
cancel_namespace_project_pipeline_path(pipeline.project.namespace,
pipeline.project,
pipeline.id)