mirror of https://github.com/zulip/zulip.git
Add narrow.narrow_to_next_pm_string().
This helper function will allow us to cycle through PM narrows that are unread, once we map it to a hotkey and/or other UI. (We intend to make something like the "n" key for topics, but that works on PM narrows instead.)
This commit is contained in:
parent
13abed229c
commit
35cc206dcc
|
@ -362,6 +362,31 @@ exports.narrow_to_next_topic = function () {
|
|||
};
|
||||
|
||||
|
||||
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);
|
||||
|
||||
if (!next_pm) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Hopefully someday we can narrow by user_ids_string instead of
|
||||
// mapping back to emails.
|
||||
var pm_with = people.user_ids_string_to_emails_string(next_pm);
|
||||
|
||||
var filter_expr = [
|
||||
{operator: 'pm-with', operand: pm_with},
|
||||
];
|
||||
|
||||
var opts = {
|
||||
select_first_unread: true,
|
||||
};
|
||||
|
||||
exports.activate(filter_expr, opts);
|
||||
};
|
||||
|
||||
|
||||
// Activate narrowing with a single operator.
|
||||
// This is just for syntactic convenience.
|
||||
exports.by = function (operator, operand, opts) {
|
||||
|
|
Loading…
Reference in New Issue