Skip to content

A platform for community discussion. Free, open, simple.

FIX: `jumpToPost` no working on megatopics.

Guo Xiang Tanb459a589ab96
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() {