mirror of https://github.com/zulip/zulip.git
Convert to string before using string methods on search operators
Previously, narrowing to a stream name that only contained digits would throw an exception. (imported from commit dc76877427078d70e3d5625622c665be3302c976)
This commit is contained in:
parent
db3ded4e84
commit
0e4aa6727b
|
@ -72,7 +72,7 @@ function unparse(operators) {
|
||||||
// a colon are glued together to form a search term.
|
// a colon are glued together to form a search term.
|
||||||
parts.push(elem[1]);
|
parts.push(elem[1]);
|
||||||
} else {
|
} else {
|
||||||
parts.push(elem[0] + ':' + encodeOperand(elem[1].toLowerCase()));
|
parts.push(elem[0] + ':' + encodeOperand(elem[1].toString().toLowerCase()));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
return parts.join(' ');
|
return parts.join(' ');
|
||||||
|
@ -200,7 +200,7 @@ function build_filter(operators_mixed_case) {
|
||||||
var operators = [];
|
var operators = [];
|
||||||
// We don't use $.map because it flattens returned arrays.
|
// We don't use $.map because it flattens returned arrays.
|
||||||
$.each(operators_mixed_case, function (idx, operator) {
|
$.each(operators_mixed_case, function (idx, operator) {
|
||||||
operators.push([operator[0], operator[1].toLowerCase()]);
|
operators.push([operator[0], operator[1].toString().toLowerCase()]);
|
||||||
});
|
});
|
||||||
|
|
||||||
// FIXME: This is probably pretty slow.
|
// FIXME: This is probably pretty slow.
|
||||||
|
@ -294,7 +294,7 @@ exports.activate = function (operators, opts) {
|
||||||
|
|
||||||
var collapse_messages = true;
|
var collapse_messages = true;
|
||||||
$.each(operators, function (idx, operator) {
|
$.each(operators, function (idx, operator) {
|
||||||
if (operator[0].toLowerCase() === 'search') {
|
if (operator[0].toString().toLowerCase() === 'search') {
|
||||||
collapse_messages = false;
|
collapse_messages = false;
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue