REFACTOR: topic-from-params route (#7689)

REFACTOR: topic-from-params route (#7689)

diff --git a/app/assets/javascripts/discourse/routes/topic-from-params.js.es6 b/app/assets/javascripts/discourse/routes/topic-from-params.js.es6
index ebb7532..63a0ebc 100644
--- a/app/assets/javascripts/discourse/routes/topic-from-params.js.es6
+++ b/app/assets/javascripts/discourse/routes/topic-from-params.js.es6
@@ -17,9 +17,8 @@ export default Discourse.Route.extend({
     params = params || {};
     params.track_visit = true;
 
-    const self = this,
-      topic = this.modelFor("topic"),
-      postStream = topic.get("postStream"),
+    const topic = this.modelFor("topic"),
+      postStream = topic.postStream,
       topicController = this.controllerFor("topic"),
       composerController = this.controllerFor("composer");
 
@@ -32,7 +31,7 @@ export default Discourse.Route.extend({
 
     postStream
       .refresh(params)
-      .then(function() {
+      .then(() => {
         // TODO we are seeing errors where closest post is null and this is exploding
         // we need better handling and logging for this condition.
 
@@ -40,22 +39,20 @@ export default Discourse.Route.extend({
         const closestPost = postStream.closestPostForPostNumber(
           params.nearPost || 1
         );
-        const closest = closestPost.get("post_number");
+        const closest = closestPost.post_number;
 
         topicController.setProperties({
           "model.currentPost": closest,
-          enteredIndex: topic
-            .get("postStream")
-            .progressIndexOfPost(closestPost),
+          enteredIndex: topic.postStream.progressIndexOfPost(closestPost),
           enteredAt: new Date().getTime().toString()
         });
 
         topicController.subscribe();
 
         // Highlight our post after the next render
-        Ember.run.scheduleOnce("afterRender", function() {
-          self.appEvents.trigger("post:highlight", closest);
-        });
+        Ember.run.scheduleOnce("afterRender", () =>
+          this.appEvents.trigger("post:highlight", closest)
+        );
 
         const opts = {};
         if (document.location.hash && document.location.hash.length) {
@@ -63,13 +60,13 @@ export default Discourse.Route.extend({
         }
         DiscourseURL.jumpToPost(closest, opts);
 
-        if (!Ember.isEmpty(topic.get("draft"))) {
+        if (!Ember.isEmpty(topic.draft)) {
           composerController.open({
-            draft: Draft.getLocal(topic.get("draft_key"), topic.get("draft")),
-            draftKey: topic.get("draft_key"),
-            draftSequence: topic.get("draft_sequence"),
-            topic: topic,
-            ignoreIfChanged: true
+            draft: Draft.getLocal(topic.draft_key, topic.draft),
+            draftKey: topic.draft_key,
+            draftSequence: topic.draft_sequence,
+            ignoreIfChanged: true,
+            topic
           });
         }
       })

GitHub sha: 4201329f