mirror of
https://github.com/discourse/discourse.git
synced 2025-05-21 18:12:32 +08:00
remove useless upload topic direct association
This commit is contained in:
@ -2,16 +2,15 @@ class UploadsController < ApplicationController
|
||||
before_filter :ensure_logged_in
|
||||
|
||||
def create
|
||||
params.require(:topic_id)
|
||||
file = params[:file] || params[:files].first
|
||||
|
||||
|
||||
# only supports images for now
|
||||
return render status: 415, json: failed_json unless file.content_type =~ /^image\/.+/
|
||||
|
||||
upload = Upload.create_for(current_user.id, file, params[:topic_id])
|
||||
|
||||
|
||||
upload = Upload.create_for(current_user.id, file)
|
||||
|
||||
render_serialized(upload, UploadSerializer, root: false)
|
||||
|
||||
|
||||
rescue FastImage::ImageFetchFailure
|
||||
render status: 422, text: I18n.t("upload.image.fetch_failure")
|
||||
rescue FastImage::UnknownImageType
|
||||
|
Reference in New Issue
Block a user