mirror of
https://github.com/discourse/discourse.git
synced 2024-11-27 22:23:44 +08:00
FIX: On mobile jumping to replies was not working
This commit is contained in:
parent
4b7046efa4
commit
7e97724341
|
@ -11,9 +11,7 @@ const DiscourseURL = Ember.Object.createWithMixins({
|
|||
return _jumpScheduled;
|
||||
},
|
||||
|
||||
/**
|
||||
Jumps to a particular post in the stream
|
||||
**/
|
||||
// Jumps to a particular post in the stream
|
||||
jumpToPost(postNumber, opts) {
|
||||
const holderId = `#post_${postNumber}`;
|
||||
const offset = () => {
|
||||
|
|
|
@ -348,12 +348,20 @@ createWidget('post-article', {
|
|||
return rows;
|
||||
},
|
||||
|
||||
_getTopicUrl() {
|
||||
const post = this.findAncestorModel();
|
||||
return post ? post.get('topic.url') : null;
|
||||
},
|
||||
|
||||
toggleReplyAbove() {
|
||||
const replyPostNumber = this.attrs.reply_to_post_number;
|
||||
|
||||
// jump directly on mobile
|
||||
if (this.attrs.mobileView) {
|
||||
DiscourseURL.jumpToPost(replyPostNumber);
|
||||
const topicUrl = this._getTopicUrl();
|
||||
if (topicUrl) {
|
||||
DiscourseURL.routeTo(`${topicUrl}/${replyPostNumber}`);
|
||||
}
|
||||
return Ember.RSVP.Promise.resolve();
|
||||
}
|
||||
|
||||
|
@ -361,8 +369,7 @@ createWidget('post-article', {
|
|||
this.state.repliesAbove = [];
|
||||
return Ember.RSVP.Promise.resolve();
|
||||
} else {
|
||||
const post = this.findAncestorModel();
|
||||
const topicUrl = post ? post.get('topic.url') : null;
|
||||
const topicUrl = this._getTopicUrl();
|
||||
return this.store.find('post-reply-history', { postId: this.attrs.id }).then(posts => {
|
||||
this.state.repliesAbove = posts.map((p) => {
|
||||
p.shareUrl = `${topicUrl}/${p.post_number}`;
|
||||
|
|
Loading…
Reference in New Issue
Block a user