mirror of
https://github.com/zulip/zulip.git
synced 2025-11-06 15:03:34 +00:00
Change operator canonicalizations.
Streams are converted to their "official" names now. Topics are not canonicalized at all. All other operands continue to be lowercased. Since we don't lowercase stream/topic at the parsing stage, we have to modify the predicate function to do the lowercasing of stream/topic to enable case-insensitive comparisons. This is slightly more expensive. The server-side predicate functions are already case-insensitive. (imported from commit 286f118c6c3ff9d23b37c7f958cab4c0eacd5feb)
This commit is contained in:
@@ -32,7 +32,16 @@ Filter.canonicalize_tuple = function (tuple) {
|
||||
var operand = tuple[1];
|
||||
|
||||
operator = Filter.canonicalize_operator(operator);
|
||||
operand = stream_data.canonicalized_name(operand);
|
||||
|
||||
switch (operator) {
|
||||
case 'stream':
|
||||
operand = stream_data.get_name(operand);
|
||||
break;
|
||||
case 'topic':
|
||||
break;
|
||||
default:
|
||||
operand = operand.toString().toLowerCase();
|
||||
}
|
||||
|
||||
// We may want to consider allowing mixed-case operators at some point
|
||||
return [operator, operand];
|
||||
@@ -147,6 +156,7 @@ Filter.prototype = {
|
||||
return false;
|
||||
}
|
||||
|
||||
operand = operand.toLowerCase();
|
||||
if (page_params.domain === "mit.edu") {
|
||||
// MIT users expect narrowing to "social" to also show messages to /^(un)*social(.d)*$/
|
||||
// (unsocial, ununsocial, social.d, etc)
|
||||
@@ -170,6 +180,7 @@ Filter.prototype = {
|
||||
return false;
|
||||
}
|
||||
|
||||
operand = operand.toLowerCase();
|
||||
if (page_params.domain === "mit.edu") {
|
||||
// MIT users expect narrowing to topic "foo" to also show messages to /^foo(.d)*$/
|
||||
// (foo, foo.d, foo.d.d, etc)
|
||||
|
||||
Reference in New Issue
Block a user