search/hash_util: Parse negated searches properly.

Fixes #14254

You can test this on dev:

    * do "-stream:Verona" in the search bar (the minus
      sign negates the search here)
    * reload the browser

You should see the same search (all streams besides Verona).
This commit is contained in:
Steve Howell
2020-03-20 18:56:01 +00:00
committed by Tim Abbott
parent 778d457bf7
commit 9c027e76bb
2 changed files with 16 additions and 3 deletions

View File

@@ -166,12 +166,13 @@ exports.parse_narrow = function (hash) {
return;
}
const operand = exports.decode_operand(operator, raw_operand);
let negated = false;
if (operator[0] === '-') {
negated = true;
operator = operator.slice(1);
}
const operand = exports.decode_operand(operator, raw_operand);
operators.push({negated: negated, operator: operator, operand: operand});
}
return operators;