mirror of
https://github.com/zulip/zulip.git
synced 2025-11-03 21:43:21 +00:00
Fix misc. uses of search tuples.
(imported from commit c7dc47c1396eb0d9f6821cafcb3dc90d283b4764)
This commit is contained in:
@@ -311,7 +311,7 @@ exports.activate = function (raw_operators, opts) {
|
|||||||
// Activate narrowing with a single operator.
|
// Activate narrowing with a single operator.
|
||||||
// This is just for syntactic convenience.
|
// This is just for syntactic convenience.
|
||||||
exports.by = function (operator, operand, opts) {
|
exports.by = function (operator, operand, opts) {
|
||||||
exports.activate([[operator, operand]], opts);
|
exports.activate([{operator: operator, operand: operand}], opts);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.by_subject = function (target_id, opts) {
|
exports.by_subject = function (target_id, opts) {
|
||||||
@@ -324,11 +324,12 @@ exports.by_subject = function (target_id, opts) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
unread.mark_message_as_read(original);
|
unread.mark_message_as_read(original);
|
||||||
|
var search_terms = [
|
||||||
|
{operator: 'stream', operand: original.stream},
|
||||||
|
{operator: 'topic', operand: original.subject}
|
||||||
|
];
|
||||||
opts = _.defaults({}, opts, {then_select_id: target_id});
|
opts = _.defaults({}, opts, {then_select_id: target_id});
|
||||||
exports.activate([
|
exports.activate(search_terms, opts);
|
||||||
['stream', original.stream],
|
|
||||||
['topic', original.subject]
|
|
||||||
], opts);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
// Called for the 'narrow by stream' hotkey.
|
// Called for the 'narrow by stream' hotkey.
|
||||||
@@ -350,24 +351,24 @@ exports.by_recipient = function (target_id, opts) {
|
|||||||
|
|
||||||
exports.by_time_travel = function (target_id, opts) {
|
exports.by_time_travel = function (target_id, opts) {
|
||||||
opts = _.defaults({}, opts, {then_select_id: target_id});
|
opts = _.defaults({}, opts, {then_select_id: target_id});
|
||||||
narrow.activate([["near", target_id]], opts);
|
narrow.activate([{operator: "near", operand: target_id}], opts);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.by_id = function (target_id, opts) {
|
exports.by_id = function (target_id, opts) {
|
||||||
opts = _.defaults({}, opts, {then_select_id: target_id});
|
opts = _.defaults({}, opts, {then_select_id: target_id});
|
||||||
narrow.activate([["id", target_id]], opts);
|
narrow.activate([{operator: "id", operand: target_id}], opts);
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.by_conversation_and_time = function (target_id, opts) {
|
exports.by_conversation_and_time = function (target_id, opts) {
|
||||||
var args = [["near", target_id]];
|
var args = [{operator: "near", operand: target_id}];
|
||||||
var original = message_store.get(target_id);
|
var original = message_store.get(target_id);
|
||||||
opts = _.defaults({}, opts, {then_select_id: target_id});
|
opts = _.defaults({}, opts, {then_select_id: target_id});
|
||||||
|
|
||||||
if (original.type !== 'stream') {
|
if (original.type !== 'stream') {
|
||||||
args.push(["pm-with", original.reply_to]);
|
args.push({operator: "pm-with", operand: original.reply_to});
|
||||||
} else {
|
} else {
|
||||||
args.push(['stream', original.stream]);
|
args.push({operator: 'stream', operand: original.stream});
|
||||||
args.push(['topic', original.subject]);
|
args.push({operator: 'topic', operand: original.subject});
|
||||||
}
|
}
|
||||||
narrow.activate(args, opts);
|
narrow.activate(args, opts);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -347,7 +347,10 @@ exports.register_click_handlers = function () {
|
|||||||
var stream_name = row.attr('data-stream-name');
|
var stream_name = row.attr('data-stream-name');
|
||||||
var topic_name = row.attr('data-topic-name');
|
var topic_name = row.attr('data-topic-name');
|
||||||
|
|
||||||
var operators = [['stream', stream_name], ['topic', topic_name]];
|
var operators = [
|
||||||
|
{operator: 'stream', operand: stream_name},
|
||||||
|
{operator: 'topic', operand: topic_name}
|
||||||
|
];
|
||||||
var opts = {select_first_unread: true, trigger: 'sidebar'};
|
var opts = {select_first_unread: true, trigger: 'sidebar'};
|
||||||
narrow.activate(operators, opts);
|
narrow.activate(operators, opts);
|
||||||
|
|
||||||
|
|||||||
@@ -284,7 +284,7 @@ function get_topic_suggestions(query_operators) {
|
|||||||
// not want to suggest topics, but I feel this is a very
|
// not want to suggest topics, but I feel this is a very
|
||||||
// minor issue, and Filter.parse() is currently lossy
|
// minor issue, and Filter.parse() is currently lossy
|
||||||
// in terms of telling us whether they provided the operator,
|
// in terms of telling us whether they provided the operator,
|
||||||
// i.e. "foo" and "search:foo" both become [['search', 'foo']].
|
// i.e. "foo" and "search:foo" both become [{operator: 'search', operand: 'foo'}].
|
||||||
switch (operator) {
|
switch (operator) {
|
||||||
case 'stream':
|
case 'stream':
|
||||||
filter = new Filter(query_operators);
|
filter = new Filter(query_operators);
|
||||||
|
|||||||
@@ -509,8 +509,8 @@ $(function () {
|
|||||||
var stream = $(e.target).parents('ul').attr('data-stream');
|
var stream = $(e.target).parents('ul').attr('data-stream');
|
||||||
var subject = $(e.target).parents('li').attr('data-name');
|
var subject = $(e.target).parents('li').attr('data-name');
|
||||||
|
|
||||||
narrow.activate([['stream', stream],
|
narrow.activate([{operator: 'stream', operand: stream},
|
||||||
['topic', subject]],
|
{operator: 'topic', operand: subject}],
|
||||||
{select_first_unread: true, trigger: 'sidebar'});
|
{select_first_unread: true, trigger: 'sidebar'});
|
||||||
|
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
|
|||||||
@@ -353,7 +353,7 @@ function finale() {
|
|||||||
|
|
||||||
// We start you in a narrow so it's not overwhelming.
|
// We start you in a narrow so it's not overwhelming.
|
||||||
if (stream_data.in_home_view(page_params.notifications_stream)) {
|
if (stream_data.in_home_view(page_params.notifications_stream)) {
|
||||||
narrow.activate([["stream", page_params.notifications_stream]]);
|
narrow.activate([{operator: "stream", operand: page_params.notifications_stream}]);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (page_params.first_in_realm) {
|
if (page_params.first_in_realm) {
|
||||||
|
|||||||
@@ -3,7 +3,7 @@ var all_msg_list = new MessageList(
|
|||||||
{muting_enabled: false}
|
{muting_enabled: false}
|
||||||
);
|
);
|
||||||
var home_msg_list = new MessageList('zhome',
|
var home_msg_list = new MessageList('zhome',
|
||||||
new Filter([["in", "home"]]),
|
new Filter([{operator: "in", operand: "home"}]),
|
||||||
{
|
{
|
||||||
muting_enabled: true,
|
muting_enabled: true,
|
||||||
summarize_read: feature_flags.summarize_read_while_narrowed?'home':false
|
summarize_read: feature_flags.summarize_read_while_narrowed?'home':false
|
||||||
|
|||||||
Reference in New Issue
Block a user