FEATURE: Move emoji uploader to use uppy (#14814)

This commit changes the emoji uploader to use the UppyUploadMixin,
and makes some minor changes to the emoji uploader (tightening the
copy for drag and drop and adding a percentage for the upload).

Since no other uppy upload mixin components have needed to upload
multiple files so far, this necessitated adding a tracker for the
in progress uploads so we know when to reset the uploader once all
uploads are complete.

At the moment, the emoji uploader cannot be used for direct S3 uploads
because the admin emoji controller creates other records and does other
magic with the emojis. At some point we need to factor this kind of thing
into the ExternalUploadManager.transform! action to complete external
uploads.
This commit is contained in:
Martin Brennan
2021-11-04 11:31:58 +10:00
committed by GitHub
parent 892e33fd93
commit fac9185421
5 changed files with 36 additions and 13 deletions

View File

@@ -6,6 +6,9 @@ class Admin::EmojisController < Admin::AdminController
render_serialized(Emoji.custom, EmojiSerializer, root: false)
end
# TODO (martin) Figure out a way that this kind of custom logic can
# be run in the ExternalUploadManager when a direct S3 upload is completed,
# related to preventDirectS3Uploads in the UppyUploadMixin.
def create
file = params[:file] || params[:files].first
name = params[:name] || File.basename(file.original_filename, ".*")