diff --git a/zephyr/static/js/narrow.js b/zephyr/static/js/narrow.js index 8625c0a2d4..84afdd1309 100644 --- a/zephyr/static/js/narrow.js +++ b/zephyr/static/js/narrow.js @@ -10,6 +10,17 @@ function Filter(operators) { } } +var canonical_operators = {"from": "sender"}; + +exports.canonicalize_operator = function (operator) { + operator = operator.toLowerCase(); + if (canonical_operators[operator] !== undefined) { + return canonical_operators[operator]; + } else { + return operator; + } +}; + Filter.prototype = { predicate: function Filter_predicate() { if (this._predicate === undefined) { @@ -85,7 +96,8 @@ Filter.prototype = { // We don't use $.map because it flattens returned arrays. $.each(operators_mixed_case, function (idx, operator) { // We may want to consider allowing mixed-case operators at some point - new_operators.push([operator[0], subs.canonicalized_name(operator[1])]); + new_operators.push([exports.canonicalize_operator(operator[0]), + subs.canonicalized_name(operator[1])]); }); return new_operators; }, diff --git a/zephyr/static/js/search.js b/zephyr/static/js/search.js index ca9e3ef521..768b8bb1fc 100644 --- a/zephyr/static/js/search.js +++ b/zephyr/static/js/search.js @@ -46,7 +46,7 @@ function stream_matches_query(stream_name, q) { function describe(operators) { return $.map(operators, function (elem) { var operand = elem[1]; - switch (elem[0]) { + switch (narrow.canonicalize_operator(elem[0])) { case 'is': if (operand === 'private') { return 'Narrow to all private messages';