FIX: Emoji uploader not using data.name on uppy upload (#14958)

FIX: Emoji uploader not using data.name on uppy upload (#14958)

When uploading emoji with the new uppy upload mixin, we were not sending the name of the emoji in the payload, or more accurately uppy was already using the file name as the name value and we were not overriding it from data. This commit changes the behaviour for single files uploaded via the uppy upload mixin, by merging the file’s meta object with this.data from the parent component.

diff --git a/app/assets/javascripts/discourse/app/mixins/uppy-upload.js b/app/assets/javascripts/discourse/app/mixins/uppy-upload.js
index 3fe51ea..cabcfc2 100644
--- a/app/assets/javascripts/discourse/app/mixins/uppy-upload.js
+++ b/app/assets/javascripts/discourse/app/mixins/uppy-upload.js
@@ -119,6 +119,13 @@ export default Mixin.create(UppyS3Multipart, {
           this._reset();
           return false;
         }
+
+        // for a single file, we want to override file meta with the
+        // data property (which may be computed), to override any keys
+        // specified by this.data (such as name)
+        if (fileCount === 1) {
+          deepMerge(Object.values(files)[0].meta, this.data);
+        }
       },
     });
 

GitHub sha: f61783a21814a74f6fcc03c219b8f62ca52c771d

This commit appears in #14958 which was approved by CvX. It was merged by martin.