Add hotkey for narrowing to next unread topic.

Fixes: #4199.
This commit is contained in:
Mahim Goyal 2017-03-23 17:53:49 +05:30 committed by Tim Abbott
parent 40e43d8cba
commit 49fec57768
4 changed files with 20 additions and 2 deletions

View File

@ -245,6 +245,16 @@ function stubbing(func_name_to_stub, test_function) {
assert_mapping(':', 'emoji_picker.toggle_emoji_popover', true);
assert_mapping('G', 'navigate.to_end');
assert_mapping('M', 'muting_ui.toggle_mute');
// Test keys that work when a message is selected and
// also when the message list is empty.
assert_mapping('n', 'narrow.narrow_to_next_topic');
global.current_msg_list.empty = return_true;
assert_mapping('n', 'narrow.narrow_to_next_topic');
global.current_msg_list.empty = return_false;
}());
(function test_motion_keys() {

View File

@ -115,7 +115,7 @@ var keypress_mappings = {
105: {name: 'message_actions', message_view_only: true}, // 'i'
106: {name: 'vim_down', message_view_only: true}, // 'j'
107: {name: 'vim_up', message_view_only: true}, // 'k'
110: {name: 'new_stream', message_view_only: false}, // 'n'
110: {name: 'n_key', message_view_only: false}, // 'n'
113: {name: 'query_users', message_view_only: false}, // 'q'
114: {name: 'reply_message', message_view_only: true}, // 'r'
115: {name: 'narrow_by_recipient', message_view_only: true}, // 's'
@ -591,9 +591,11 @@ exports.process_hotkey = function (e, hotkey) {
subs.view_stream();
}
return true;
case 'new_stream':
case 'n_key':
if (exports.is_subs()) {
subs.new_stream_clicked();
} else {
narrow.narrow_to_next_topic();
}
return true;
case 'open_drafts':

View File

@ -69,6 +69,8 @@ Zulip keyboard shortcuts are divided into four categories:
messages with the topic of the selected message (outlined in blue).
* **Narrow to all private messages**: `P` - This shortcut narrows the
view to show all of the user's private messages.
* **Narrow to next unread topic**: `n` - This shortcut narrows the
view to the next unread topic in the stream sidebar.
* **Cycle between stream narrows**: `A` and `D` - This shortcut allows the
user to cycle through the narrows showing the messages of a stream
according to Stream order in the left sidebar. `A` allows the user

View File

@ -106,6 +106,10 @@
<td class="hotkey">P</td>
<td class="definition">{% trans %}Narrow to all private messages{% endtrans %}</td>
</tr>
<tr>
<td class="hotkey">n</td>
<td class="definition">{% trans %}Narrow to next unread topic{% endtrans %}</td>
</tr>
<tr>
<td class="hotkey">A or D</td>
<td class="definition">{% trans %}Cycle between stream narrows{% endtrans %}</td>