mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	Prevent browser errors for stream: searches.
When we typed "stream:" into the search bar, the empty operand triggered an error in the Dict class for an undefined key, because we were using opts[0] as a "defensive" workaround to opts.operand, but opts.operand of '' is more correct than opts[0] being undefined. Now we only fall back to opts[0] whe opts.operand is undefined, and we emit a blueslip error when that happens. (imported from commit 88a196d3bc3d67689c36bc036f378da744c652f9)
This commit is contained in:
		@@ -151,9 +151,14 @@ Filter.canonicalize_operator = function (operator) {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
Filter.canonicalize_term = function (opts) {
 | 
			
		||||
    // Legacy code may still call use with a tuple of [operator, operand].
 | 
			
		||||
    var operator = opts.operator || opts[0];
 | 
			
		||||
    var operand = opts.operand || opts[1];
 | 
			
		||||
    var operator = opts.operator;
 | 
			
		||||
    var operand = opts.operand;
 | 
			
		||||
 | 
			
		||||
    if (operator === undefined) {
 | 
			
		||||
        blueslip.error("Old-style tuple operators are still in use for canonicalize_term");
 | 
			
		||||
        operator = opts[0];
 | 
			
		||||
        operand = opts[1];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    operator = Filter.canonicalize_operator(operator);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user