Simplify the skip_before_filter
logic for UploadsController
This commit is contained in:
parent
926a814641
commit
10053b173d
1 changed files with 2 additions and 5 deletions
|
@ -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]).
|
||||
|
|
Loading…
Reference in a new issue