REFACTOR: change-timestamp controller (#7498)

REFACTOR: change-timestamp controller (#7498)

diff --git a/app/assets/javascripts/discourse/controllers/change-timestamp.js.es6 b/app/assets/javascripts/discourse/controllers/change-timestamp.js.es6
index 87df9f2..6d64eb3 100644
--- a/app/assets/javascripts/discourse/controllers/change-timestamp.js.es6
+++ b/app/assets/javascripts/discourse/controllers/change-timestamp.js.es6
@@ -17,7 +17,7 @@ export default Ember.Controller.extend(ModalFunctionality, {
 
   @computed("date", "time")
   createdAt(date, time) {
-    return moment(date + " " + time, "YYYY-MM-DD HH:mm:ss");
+    return moment(`${date} ${time}`, "YYYY-MM-DD HH:mm:ss");
   },
 
   @computed("createdAt")
@@ -26,35 +26,32 @@ export default Ember.Controller.extend(ModalFunctionality, {
   },
 
   @computed("saving", "date", "validTimestamp")
-  buttonDisabled() {
-    if (this.get("saving") || this.get("validTimestamp")) return true;
-    return Ember.isEmpty(this.get("date"));
+  buttonDisabled(saving, date, validTimestamp) {
+    if (saving || validTimestamp) return true;
+    return Ember.isEmpty(date);
   },
 
-  onShow: function() {
-    this.setProperties({
-      date: moment().format("YYYY-MM-DD")
-    });
+  onShow() {
+    this.set("date", moment().format("YYYY-MM-DD"));
   },
 
   actions: {
-    changeTimestamp: function() {
+    changeTimestamp() {
       this.set("saving", true);
-      const self = this,
-        topic = this.get("topicController.model");
-
-      Topic.changeTimestamp(topic.get("id"), this.get("createdAt").unix())
-        .then(function() {
-          self.send("closeModal");
-          self.setProperties({ date: "", time: "", saving: false });
-          Ember.run.next(() => {
-            DiscourseURL.routeTo(topic.get("url"));
-          });
+
+      const topic = this.topicController.model;
+
+      Topic.changeTimestamp(topic.id, this.createdAt.unix())
+        .then(() => {
+          this.send("closeModal");
+          this.setProperties({ date: "", time: "", saving: false });
+          Ember.run.next(() => DiscourseURL.routeTo(topic.url));
         })
-        .catch(function() {
-          self.flash(I18n.t("topic.change_timestamp.error"), "alert-error");
-          self.set("saving", false);
-        });
+        .catch(() =>
+          this.flash(I18n.t("topic.change_timestamp.error"), "alert-error")
+        )
+        .finally(() => this.set("saving", false));
+
       return false;
     }
   }

GitHub sha: 4aaee7ee