summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRobert Speicher <rspeicher@gmail.com>2015-04-20 13:40:17 -0400
committerRobert Speicher <rspeicher@gmail.com>2015-04-23 13:15:47 -0400
commit10053b173d6e26eaa603475b2bdfde2e3c407eba (patch)
tree45914e85987f38f454d8d2d0a263b05d067d4553
parent926a814641cddc6219e63c4ffb604b47af86c686 (diff)
downloadgitlab-ce-rs-simplify-uploads-controller.tar.gz
Simplify the `skip_before_filter` logic for UploadsControllerrs-simplify-uploads-controller
-rw-r--r--app/controllers/projects/uploads_controller.rb7
1 files changed, 2 insertions, 5 deletions
diff --git a/app/controllers/projects/uploads_controller.rb b/app/controllers/projects/uploads_controller.rb
index 6153ca2dc1b..e2d0b0d9459 100644
--- a/app/controllers/projects/uploads_controller.rb
+++ b/app/controllers/projects/uploads_controller.rb
@@ -1,11 +1,8 @@
class Projects::UploadsController < Projects::ApplicationController
layout 'project'
- # We want to skip these filters for only the `show` action if `image?` is true,
- # but `skip_before_filter` doesn't work with both `only` and `if`, so we accomplish the same like this.
- skipped_filters = [:authenticate_user!, :reject_blocked!, :project, :repository]
- skip_before_action *skipped_filters, only: [:show]
- before_action *skipped_filters, only: [:show], unless: :image?
+ skip_before_action :authenticate_user!, :reject_blocked!, :project,
+ :repository, if: -> { action_name == 'show' && image? }
def create
link_to_file = ::Projects::UploadService.new(project, params[:file]).