Revert "Ensure server still gets narrow operators as tuples."

This reverts commit 64aced74012101f3bdbd3a4e6066b46ad8e1f4ea,
which was always intended as temporary code until we upgraded
the back end to support dictionary-style narrow operators.

(imported from commit b8d3a19f3aad3d9d6a26b9dcc07f502c55b18edd)
This commit is contained in:
Steve Howell
2014-02-11 11:22:23 -05:00
parent afe893b324
commit bf08e33648

View File

@@ -165,19 +165,6 @@ exports.add_messages = function add_messages(messages, msg_list, opts) {
}
};
function server_style(operators) {
// Our server still accepts narrow terms in the old-school tuple
// format, and it will support that style for a while, since we have
// some legacy clients in the wild. But soon the server will also
// support new-style operators, so this function is just temporary.
// (There are some complications in making the server support both,
// so even though this code is kind of throwaway, it is a safer
// path to the end game.)
return _.map(operators, function (term) {
return [term.operator, term.operand];
});
}
function maybe_add_narrowed_messages(messages, msg_list, messages_are_new) {
var ids = [];
_.each(messages, function (elem) {
@@ -188,7 +175,7 @@ function maybe_add_narrowed_messages(messages, msg_list, messages_are_new) {
url: '/json/messages_in_narrow',
idempotent: true,
data: {msg_ids: JSON.stringify(ids),
narrow: JSON.stringify(server_style(narrow.public_operators()))},
narrow: JSON.stringify(narrow.public_operators())},
timeout: 5000,
success: function (data) {
if (msg_list !== current_msg_list) {
@@ -418,10 +405,10 @@ exports.load_old_messages = function load_old_messages(opts) {
if (page_params.narrow !== undefined) {
operators = operators.concat(page_params.narrow);
}
data.narrow = JSON.stringify(server_style(operators));
data.narrow = JSON.stringify(operators);
}
if (opts.msg_list === home_msg_list && page_params.narrow_stream !== undefined) {
data.narrow = JSON.stringify(server_style(page_params.narrow));
data.narrow = JSON.stringify(page_params.narrow);
}
if (opts.use_first_unread_anchor) {
data.use_first_unread_anchor = true;