Remove tuples safety net for narrow filters on staging.

We have shim code that makes our internal narrow operators
support both a tuple interface and an object interface.  We
are removing the shim on staging to help expose any dark
corners of the code that still rely on operators being
represented as tuples.

(imported from commit f9d101dbb7f49a4abec14806734b9c86bd93c4e1)
This commit is contained in:
Steve Howell
2014-02-06 16:18:56 -05:00
committed by Tim Abbott
parent 5c2a41f8b7
commit 2fb70eb38c
5 changed files with 19 additions and 2 deletions

View File

@@ -54,6 +54,7 @@ exports.propagate_topic_edits = true;
exports.summarize_read_while_narrowed = false;
exports.clicking_notification_causes_narrow = true;
exports.use_socket = true;
exports.remove_filter_tuples_safety_net = page_params.staging;
// Ready for deprecation.
exports.collapsible = false;

View File

@@ -3,9 +3,14 @@ var Filter = (function () {
function filter_term(opts) {
// For legacy reasons we must represent filter_terms as tuples
// until we phase out all the code that assumes tuples.
// We are very close to removing the tuple code everywhere; for
// now, we remove the safety net on staging only.
var term = [];
term[0] = opts.operator;
term[1] = opts.operand;
if (!feature_flags.remove_filter_tuples_safety_net) {
term[0] = opts.operator;
term[1] = opts.operand;
}
// This is the new style we are phasing in. (Yes, the same
// object can be treated like either a tuple or a struct.)

View File

@@ -7,6 +7,9 @@ set_global('page_params', {
email: 'hamlet@zulip.com',
domain: 'zulip.com'
});
set_global('feature_flags', {
remove_filter_tuples_safety_net: false
});
var Filter = require('js/filter.js');
var _ = global._;

View File

@@ -7,6 +7,10 @@ var narrow = require('js/narrow.js');
var Filter = global.Filter;
var stream_data = global.stream_data;
set_global('feature_flags', {
remove_filter_tuples_safety_net: false
});
function set_filter(operators) {
narrow._set_current_filter(new Filter(operators));
}

View File

@@ -28,6 +28,10 @@ set_global('stream_data', {
set_global('narrow', {});
set_global('feature_flags', {
remove_filter_tuples_safety_net: false
});
(function test_basic_get_suggestions() {
var query = 'fred';