FIX: Jump to embedded was not working when the post was far away
This commit is contained in:
parent
026bba1876
commit
acc20c87b2
|
@ -18,7 +18,7 @@ createWidget('post-link-arrow', {
|
||||||
},
|
},
|
||||||
|
|
||||||
click() {
|
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-body', [
|
||||||
h('div.topic-meta-data', [
|
h('div.topic-meta-data', [
|
||||||
this.attach('poster-name', attrs),
|
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: `<div class='cooked'>${attrs.cooked}</div>`})
|
new RawHtml({html: `<div class='cooked'>${attrs.cooked}</div>`})
|
||||||
])
|
])
|
||||||
|
|
|
@ -278,8 +278,13 @@ createWidget('post-contents', {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const topic = this.findAncestorModel().get('topic');
|
||||||
|
const topicUrl = topic.get('url');
|
||||||
return this.store.find('post-reply', { postId: this.attrs.id }).then(posts => {
|
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 = [];
|
this.state.repliesAbove = [];
|
||||||
return Ember.RSVP.Promise.resolve();
|
return Ember.RSVP.Promise.resolve();
|
||||||
} else {
|
} 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 => {
|
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);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue