diff --git a/app/assets/javascripts/discourse/widgets/embedded-post.js.es6 b/app/assets/javascripts/discourse/widgets/embedded-post.js.es6 index 62da30e9b32..767044ccb9c 100644 --- a/app/assets/javascripts/discourse/widgets/embedded-post.js.es6 +++ b/app/assets/javascripts/discourse/widgets/embedded-post.js.es6 @@ -18,7 +18,7 @@ createWidget('post-link-arrow', { }, click() { - DiscourseURL.jumpToPost(this.attrs.post_number); + DiscourseURL.routeTo(this.attrs.shareUrl); } }); @@ -32,7 +32,7 @@ export default createWidget('embedded-post', { h('div.topic-body', [ h('div.topic-meta-data', [ this.attach('poster-name', attrs), - this.attach('post-link-arrow', { above: state.above, post_number: attrs.post_number }) + this.attach('post-link-arrow', { above: state.above, shareUrl: attrs.shareUrl }) ]), new RawHtml({html: `
${attrs.cooked}
`}) ]) diff --git a/app/assets/javascripts/discourse/widgets/post.js.es6 b/app/assets/javascripts/discourse/widgets/post.js.es6 index ec36fe6f5b0..b01f6fad9b5 100644 --- a/app/assets/javascripts/discourse/widgets/post.js.es6 +++ b/app/assets/javascripts/discourse/widgets/post.js.es6 @@ -278,8 +278,13 @@ createWidget('post-contents', { return; } + const topic = this.findAncestorModel().get('topic'); + const topicUrl = topic.get('url'); return this.store.find('post-reply', { postId: this.attrs.id }).then(posts => { - this.state.repliesBelow = posts.map(transformBasicPost); + this.state.repliesBelow = posts.map(p => { + p.shareUrl = `${topicUrl}/${p.post_number}`; + return transformBasicPost(p); + }); }); }, @@ -351,8 +356,13 @@ createWidget('post-article', { this.state.repliesAbove = []; return Ember.RSVP.Promise.resolve(); } else { + const topic = this.findAncestorModel().get('topic'); + const topicUrl = topic.get('url'); return this.store.find('post-reply-history', { postId: this.attrs.id }).then(posts => { - this.state.repliesAbove = posts.map(transformBasicPost); + this.state.repliesAbove = posts.map((p) => { + p.shareUrl = `${topicUrl}/${p.post_number}`; + return transformBasicPost(p); + }); }); } },