From b459a589ab9693db91bb1c2d0c56131b3e52a676 Mon Sep 17 00:00:00 2001 From: Guo Xiang Tan <tgx_world@hotmail.com> Date: Fri, 13 Jul 2018 16:16:39 +0800 Subject: [PATCH] FIX: `jumpToPost` no working on megatopics. --- .../discourse/controllers/topic.js.es6 | 20 +++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/discourse/controllers/topic.js.es6 b/app/assets/javascripts/discourse/controllers/topic.js.es6 index adae4a7786e..4054182802d 100644 --- a/app/assets/javascripts/discourse/controllers/topic.js.es6 +++ b/app/assets/javascripts/discourse/controllers/topic.js.es6 @@ -588,16 +588,20 @@ export default Ember.Controller.extend(BufferedContent, { }, jumpToPost(postNumber) { - const postStream = this.get("model.postStream"); - let postId = postStream.findPostIdForPostNumber(postNumber); + if (this.get("model.postStream.isMegaTopic")) { + this._jumpToPostNumber(postNumber); + } else { + const postStream = this.get("model.postStream"); + let postId = postStream.findPostIdForPostNumber(postNumber); - // If we couldn't find the post, find the closest post to it - if (!postId) { - const closest = postStream.closestPostNumberFor(postNumber); - postId = postStream.findPostIdForPostNumber(closest); + // If we couldn't find the post, find the closest post to it + if (!postId) { + const closest = postStream.closestPostNumberFor(postNumber); + postId = postStream.findPostIdForPostNumber(closest); + } + + this._jumpToPostId(postId); } - - this._jumpToPostId(postId); }, jumpTop() {