debian-mirror-gitlab/app/controllers/projects/uploads_controller.rb

29 lines
587 B
Ruby
Raw Normal View History

2015-04-26 12:48:37 +05:30
class Projects::UploadsController < Projects::ApplicationController
2017-08-17 22:00:37 +05:30
include UploadsActions
2015-04-26 12:48:37 +05:30
2018-03-17 18:26:18 +05:30
# These will kick you out if you don't have access.
2017-08-17 22:00:37 +05:30
skip_before_action :project, :repository,
if: -> { action_name == 'show' && image_or_video? }
2015-04-26 12:48:37 +05:30
2017-08-17 22:00:37 +05:30
before_action :authorize_upload_file!, only: [:create]
2015-04-26 12:48:37 +05:30
2016-06-02 11:05:42 +05:30
private
2018-03-17 18:26:18 +05:30
def upload_model_class
Project
2015-04-26 12:48:37 +05:30
end
2017-08-17 22:00:37 +05:30
def uploader_class
FileUploader
end
2018-03-17 18:26:18 +05:30
def find_model
return @project if @project
namespace = params[:namespace_id]
id = params[:project_id]
Project.find_by_full_path("#{namespace}/#{id}")
end
2015-04-26 12:48:37 +05:30
end