mirror of
https://github.com/wahyd4/gitlabhq.git
synced 2026-08-13 14:46:05 +10:00
Merge branch 'rs-simplify-uploads-controller' into 'master'
Simplify the `skip_before_action` logic for UploadsController See merge request !547
This commit is contained in:
@@ -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]).
|
||||
|
||||
Reference in New Issue
Block a user