Skip to content

Commit 4a26561

Browse files
committed
Only scroll to posts that are not your own in PMs.
1 parent 7a1400c commit 4a26561

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

app/assets/javascripts/discourse/controllers/topic.js.es6

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -841,16 +841,20 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
841841
this.send('postChangedRoute', topic.get('post_number') || 1);
842842
});
843843
} else {
844-
const postNumber = data.post_number;
845-
const notInPostStream = topic.get('highest_post_number') <= postNumber;
846-
const postNumberDifference = postNumber - topic.get('currentPost');
844+
if (topic.get('isPrivateMessage') &&
845+
this.currentUser &&
846+
this.currentUser.get('id') !== data.user_id) {
847847

848-
if (notInPostStream &&
849-
topic.get('isPrivateMessage') &&
848+
const postNumber = data.post_number;
849+
const notInPostStream = topic.get('highest_post_number') <= postNumber;
850+
const postNumberDifference = postNumber - topic.get('currentPost');
851+
852+
if (notInPostStream &&
850853
postNumberDifference > 0 &&
851854
postNumberDifference < 7) {
852855

853-
this._scrollToPost(data.post_number);
856+
this._scrollToPost(data.post_number);
857+
}
854858
}
855859
}
856860
});

0 commit comments

Comments
 (0)