Adds a keyboard shortcut (shift+u) for jumping back to the last read post

This commit is contained in:
Robin Ward 2017-03-27 11:23:06 -04:00
parent 60975fcc18
commit 243b5756ee
2 changed files with 9 additions and 0 deletions

View File

@ -474,6 +474,10 @@ export default Ember.Controller.extend(SelectedPostsCount, BufferedContent, {
DiscourseURL.routeTo(this.get('model.lastPostUrl'), { skipIfOnScreen: false });
},
jumpUnread() {
this._jumpToPostId(this.get('model.last_read_post_id'));
},
selectAll() {
const posts = this.get('model.postStream.posts');
const selectedPosts = this.get('selectedPosts');

View File

@ -48,6 +48,7 @@ const bindings = {
'shift+p': {handler: 'pinUnpinTopic'},
'shift+r': {handler: 'replyToTopic'},
'shift+s': {click: '#topic-footer-buttons button.share', anonymous: true}, // share topic
'shift+u': {handler: 'goToUnreadPost'},
'shift+z shift+z': {handler: 'logout'},
't': {postAction: 'replyAsNewTopic'},
'u': {handler: 'goBack', anonymous: true},
@ -117,6 +118,10 @@ export default {
this._jumpTo('jumpBottom');
},
goToUnreadPost() {
this._jumpTo('jumpUnread');
},
_jumpTo(direction) {
if ($('.container.posts').length) {
this.container.lookup('controller:topic').send(direction);