diff options
author | Micaël Bergeron <mbergeron@gitlab.com> | 2018-01-29 20:57:34 +0300 |
---|---|---|
committer | Micaël Bergeron <mbergeron@gitlab.com> | 2018-02-01 20:14:46 +0300 |
commit | 2057a6acdee7c1f6824ff6289b0d979e8cb15f35 (patch) | |
tree | 25b911b147bfa0797dfee4cacf99f23ae5f55281 /app/controllers/projects/uploads_controller.rb | |
parent | 402f3dfc0a962dc89d8334d4d61410e67e14a55f (diff) |
port of 594e6a0a625^..f74c90f68c6
Diffstat (limited to 'app/controllers/projects/uploads_controller.rb')
-rw-r--r-- | app/controllers/projects/uploads_controller.rb | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/app/controllers/projects/uploads_controller.rb b/app/controllers/projects/uploads_controller.rb index 4685bbe80b4..f5cf089ad98 100644 --- a/app/controllers/projects/uploads_controller.rb +++ b/app/controllers/projects/uploads_controller.rb @@ -1,6 +1,7 @@ class Projects::UploadsController < Projects::ApplicationController include UploadsActions + # These will kick you out if you don't have access. skip_before_action :project, :repository, if: -> { action_name == 'show' && image_or_video? } @@ -8,14 +9,20 @@ class Projects::UploadsController < Projects::ApplicationController private - def show_model - strong_memoize(:show_model) do - namespace = params[:namespace_id] - id = params[:project_id] + def upload_model_class + Project + end - Project.find_by_full_path("#{namespace}/#{id}") - end + def uploader_class + FileUploader end - alias_method :model, :project + def find_model + return @project if @project + + namespace = params[:namespace_id] + id = params[:project_id] + + Project.find_by_full_path("#{namespace}/#{id}") + end end |