hotkeys: Add "p" to narrow to next unread PM thread.

This works simimlar to the "n" key for next topics.

This commit does a few things:

    * It wires up the hotkey to an existing function
      that could change narrows.
    * It adds documentation.
    * It adds logic to make sure the compose box does
      not open.

@showell helped a bit with the wording of comments here.

Fixes #4874
This commit is contained in:
Abhigyan Khaund
2018-02-16 20:26:25 +05:30
committed by Steve Howell
parent 68664acf1f
commit a75f0aa594
6 changed files with 33 additions and 4 deletions

View File

@@ -248,7 +248,7 @@ exports.activate = function (raw_operators, opts) {
$('#search_query').val(Filter.unparse(operators));
search.update_button_visibility();
compose_actions.on_narrow();
compose_actions.on_narrow(opts);
var current_filter = narrow_state.get_current_filter();
@@ -361,8 +361,8 @@ exports.narrow_to_next_topic = function () {
exports.activate(filter_expr, opts);
};
exports.narrow_to_next_pm_string = function () {
var curr_pm = narrow_state.pm_string();
var next_pm = topic_generator.get_next_unread_pm_string(curr_pm);
@@ -379,8 +379,10 @@ exports.narrow_to_next_pm_string = function () {
{operator: 'pm-with', operand: pm_with},
];
// force_close parameter is true to not auto open compose_box
var opts = {
select_first_unread: true,
force_close: true,
};
exports.activate(filter_expr, opts);