summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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]).