mirror of
https://github.com/discourse/discourse.git
synced 2025-05-29 01:31:35 +08:00
FEATURE: Uppy image uploader with UppyUploadMixin (#13656)
This PR adds the first use of Uppy in our codebase, hidden behind a enable_experimental_image_uploader site setting. When the setting is enabled only the user card background uploader will use the new uppy-image-uploader component added in this PR. I've introduced an UppyUpload mixin that has feature parity with the existing Upload mixin, and improves it slightly to deal with multiple/single file distinctions and validations better. For now, this just supports the XHRUpload plugin for uppy, which keeps our existing POST to /uploads.json.
This commit is contained in:
@ -23,9 +23,13 @@ describe UploadsController do
|
||||
let(:fake_jpg) { Rack::Test::UploadedFile.new(file_from_fixtures("fake.jpg")) }
|
||||
let(:text_file) { Rack::Test::UploadedFile.new(File.new("#{Rails.root}/LICENSE.txt")) }
|
||||
|
||||
it 'expects a type' do
|
||||
it 'expects a type or upload_type' do
|
||||
post "/uploads.json", params: { file: logo }
|
||||
expect(response.status).to eq(400)
|
||||
post "/uploads.json", params: { file: Rack::Test::UploadedFile.new(logo_file), type: "avatar" }
|
||||
expect(response.status).to eq 200
|
||||
post "/uploads.json", params: { file: Rack::Test::UploadedFile.new(logo_file), upload_type: "avatar" }
|
||||
expect(response.status).to eq 200
|
||||
end
|
||||
|
||||
it 'is successful with an image' do
|
||||
|
Reference in New Issue
Block a user