From 72307940bb04d29dc751adb5e76330d2ce45e9ce Mon Sep 17 00:00:00 2001 From: Grzegorz Bizon Date: Wed, 3 May 2017 12:32:39 +0200 Subject: Improve code style related to protected actions --- app/serializers/build_action_entity.rb | 2 +- app/serializers/build_entity.rb | 4 ++-- app/serializers/pipeline_entity.rb | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) (limited to 'app/serializers') 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) -- cgit v1.2.1