DEV: refactoring emoji-uploader (#6926)

DEV: refactoring emoji-uploader (#6926)

diff --git a/app/assets/javascripts/discourse/components/emoji-uploader.js.es6 b/app/assets/javascripts/discourse/components/emoji-uploader.js.es6
index f6ccab1..c9027c7 100644
--- a/app/assets/javascripts/discourse/components/emoji-uploader.js.es6
+++ b/app/assets/javascripts/discourse/components/emoji-uploader.js.es6
@@ -1,15 +1,16 @@
+import { default as computed } from "ember-addons/ember-computed-decorators";
 import UploadMixin from "discourse/mixins/upload";
 
 export default Ember.Component.extend(UploadMixin, {
   type: "emoji",
   uploadUrl: "/admin/customize/emojis",
-
   hasName: Ember.computed.notEmpty("name"),
   addDisabled: Ember.computed.not("hasName"),
 
-  data: function() {
-    return Ember.isBlank(this.get("name")) ? {} : { name: this.get("name") };
-  }.property("name"),
+  @computed("hasName", "name")
+  data(hasName, name) {
+    return hasName ? { name } : {};
+  },
 
   validateUploadedFilesOptions() {
     return { imagesOnly: true };
diff --git a/app/assets/javascripts/discourse/templates/components/emoji-uploader.hbs b/app/assets/javascripts/discourse/templates/components/emoji-uploader.hbs
index 18ddcae..f821e09 100644
--- a/app/assets/javascripts/discourse/templates/components/emoji-uploader.hbs
+++ b/app/assets/javascripts/discourse/templates/components/emoji-uploader.hbs
@@ -1,6 +1,11 @@
 {{text-field name="name" placeholderKey="admin.emoji.name" value=name}}
+
 <label class="btn btn-primary {{if addDisabled 'disabled'}}">
   {{d-icon "plus"}}
-  {{i18n 'admin.emoji.add'}}
-  <input class="hidden-upload-field" disabled={{addDisabled}} type="file" accept=".png,.gif" />
+  {{i18n "admin.emoji.add"}}
+  <input
+    class="hidden-upload-field"
+    disabled={{addDisabled}}
+    type="file"
+    accept=".png,.gif" />
 </label>

GitHub sha: 31a700da

1 Like