mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
FEATURE: move all uploads to a single endpoint + defer upload creation in a background thread
This commit is contained in:
@ -31,19 +31,6 @@ class CategoriesController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def upload
|
||||
params.require(:image_type)
|
||||
guardian.ensure_can_create!(Category)
|
||||
|
||||
file = params[:file] || params[:files].first
|
||||
upload = Upload.create_for(current_user.id, file.tempfile, file.original_filename, file.tempfile.size)
|
||||
if upload.errors.blank?
|
||||
render json: { url: upload.url, width: upload.width, height: upload.height }
|
||||
else
|
||||
render status: 422, text: upload.errors.full_messages
|
||||
end
|
||||
end
|
||||
|
||||
def move
|
||||
guardian.ensure_can_create!(Category)
|
||||
|
||||
|
Reference in New Issue
Block a user