mirror of https://github.com/zulip/zulip.git
Make narrow.operators always return an array.
Previously it could return an array or boolean, and this inconsistent interface had several latent bugs where consumers of the API only considered it returning one or the other type. This also fixes a specific bug a user triggered by being narrowed to nothing (/#narrow) and clicking in the compose box. (imported from commit 64ca2a37a9f288066f89b0ddec6638e010704eb0)
This commit is contained in:
parent
6ae117ea5f
commit
b895780c7c
|
@ -164,7 +164,7 @@ exports.predicate = function () {
|
|||
|
||||
exports.operators = function () {
|
||||
if (current_filter === undefined) {
|
||||
return false;
|
||||
return [];
|
||||
}
|
||||
return current_filter.operators();
|
||||
};
|
||||
|
@ -618,7 +618,7 @@ exports.by_stream_subject_uri = function (stream, subject) {
|
|||
exports.narrowed_to_pms = function () {
|
||||
// Are we narrowed to PMs: all PMs or PMs with particular people.
|
||||
var operators = narrow.operators();
|
||||
if (!operators) {
|
||||
if (operators.length === 0) {
|
||||
return false;
|
||||
}
|
||||
if ((operators[0][0] === "pm-with") ||
|
||||
|
|
|
@ -926,7 +926,7 @@ $(function () {
|
|||
|
||||
function focus_on_narrowed_stream() {
|
||||
var operators = narrow.operators();
|
||||
if (!operators) {
|
||||
if (operators.length === 0) {
|
||||
return;
|
||||
}
|
||||
var stream_name = operators[0][1];
|
||||
|
|
Loading…
Reference in New Issue