mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +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.
 | 
			
		||||
// This is just for syntactic convenience.
 | 
			
		||||
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) {
 | 
			
		||||
@@ -324,11 +324,12 @@ exports.by_subject = function (target_id, opts) {
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
    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});
 | 
			
		||||
    exports.activate([
 | 
			
		||||
            ['stream',  original.stream],
 | 
			
		||||
            ['topic', original.subject]
 | 
			
		||||
        ], opts);
 | 
			
		||||
    exports.activate(search_terms, opts);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
// 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) {
 | 
			
		||||
    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) {
 | 
			
		||||
    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) {
 | 
			
		||||
    var args = [["near", target_id]];
 | 
			
		||||
    var args = [{operator: "near", operand: target_id}];
 | 
			
		||||
    var original = message_store.get(target_id);
 | 
			
		||||
    opts = _.defaults({}, opts, {then_select_id: target_id});
 | 
			
		||||
 | 
			
		||||
    if (original.type !== 'stream') {
 | 
			
		||||
        args.push(["pm-with", original.reply_to]);
 | 
			
		||||
        args.push({operator: "pm-with", operand: original.reply_to});
 | 
			
		||||
    } else {
 | 
			
		||||
        args.push(['stream',  original.stream]);
 | 
			
		||||
        args.push(['topic',  original.subject]);
 | 
			
		||||
        args.push({operator: 'stream', operand: original.stream});
 | 
			
		||||
        args.push({operator: 'topic', operand: original.subject});
 | 
			
		||||
    }
 | 
			
		||||
    narrow.activate(args, opts);
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
@@ -347,7 +347,10 @@ exports.register_click_handlers = function () {
 | 
			
		||||
        var stream_name = row.attr('data-stream-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'};
 | 
			
		||||
        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
 | 
			
		||||
    // minor issue, and Filter.parse() is currently lossy
 | 
			
		||||
    // 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) {
 | 
			
		||||
    case 'stream':
 | 
			
		||||
        filter = new Filter(query_operators);
 | 
			
		||||
 
 | 
			
		||||
@@ -509,8 +509,8 @@ $(function () {
 | 
			
		||||
        var stream = $(e.target).parents('ul').attr('data-stream');
 | 
			
		||||
        var subject = $(e.target).parents('li').attr('data-name');
 | 
			
		||||
 | 
			
		||||
        narrow.activate([['stream',  stream],
 | 
			
		||||
                         ['topic', subject]],
 | 
			
		||||
        narrow.activate([{operator: 'stream',  operand: stream},
 | 
			
		||||
                         {operator: 'topic', operand: subject}],
 | 
			
		||||
                        {select_first_unread: true, trigger: 'sidebar'});
 | 
			
		||||
 | 
			
		||||
        e.preventDefault();
 | 
			
		||||
 
 | 
			
		||||
@@ -353,7 +353,7 @@ function finale() {
 | 
			
		||||
 | 
			
		||||
    // We start you in a narrow so it's not overwhelming.
 | 
			
		||||
    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) {
 | 
			
		||||
 
 | 
			
		||||
@@ -3,7 +3,7 @@ var all_msg_list = new MessageList(
 | 
			
		||||
    {muting_enabled: false}
 | 
			
		||||
);
 | 
			
		||||
var home_msg_list = new MessageList('zhome',
 | 
			
		||||
    new Filter([["in", "home"]]),
 | 
			
		||||
    new Filter([{operator: "in", operand: "home"}]),
 | 
			
		||||
    {
 | 
			
		||||
        muting_enabled: true,
 | 
			
		||||
        summarize_read: feature_flags.summarize_read_while_narrowed?'home':false
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user