mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 14:03:30 +00:00 
			
		
		
		
	lint: Add dangling commas in JavaScript objects.
This commit is contained in:
		@@ -45,7 +45,7 @@ casper.then(function () {
 | 
			
		||||
                full_name: "IagoNew",
 | 
			
		||||
                old_password: test_credentials.default_user.password,
 | 
			
		||||
                new_password: "qwertyuiop",
 | 
			
		||||
                confirm_password: "qwertyuiop"
 | 
			
		||||
                confirm_password: "qwertyuiop",
 | 
			
		||||
            });
 | 
			
		||||
            casper.click('input[name="change_settings"]');
 | 
			
		||||
        });
 | 
			
		||||
@@ -76,7 +76,7 @@ casper.then(function () {
 | 
			
		||||
            full_name: "Iago",
 | 
			
		||||
            old_password: "qwertyuiop",
 | 
			
		||||
            new_password: test_credentials.default_user.password,
 | 
			
		||||
            confirm_password: test_credentials.default_user.password
 | 
			
		||||
            confirm_password: test_credentials.default_user.password,
 | 
			
		||||
        });
 | 
			
		||||
        casper.click('input[name="change_settings"]');
 | 
			
		||||
    });
 | 
			
		||||
@@ -111,7 +111,7 @@ casper.then(function create_bot() {
 | 
			
		||||
        bot_name: 'Bot 1',
 | 
			
		||||
        bot_short_name: '1',
 | 
			
		||||
        bot_default_sending_stream: 'Denmark',
 | 
			
		||||
        bot_default_events_register_stream: 'Rome'
 | 
			
		||||
        bot_default_events_register_stream: 'Rome',
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    casper.test.info('Submiting the create bot form');
 | 
			
		||||
 
 | 
			
		||||
@@ -150,7 +150,7 @@ casper.then(function () {
 | 
			
		||||
    casper.waitForSelector('.admin-emoji-form', function () {
 | 
			
		||||
        casper.fill('form.admin-emoji-form', {
 | 
			
		||||
            name: 'MouseFace',
 | 
			
		||||
            url: 'http://zulipdev.com:9991/static/images/integrations/logos/jenkins.png'
 | 
			
		||||
            url: 'http://zulipdev.com:9991/static/images/integrations/logos/jenkins.png',
 | 
			
		||||
        });
 | 
			
		||||
        casper.click('form.admin-emoji-form input.button');
 | 
			
		||||
    });
 | 
			
		||||
@@ -180,7 +180,7 @@ casper.then(function () {
 | 
			
		||||
casper.waitForSelector('.admin-filter-form', function () {
 | 
			
		||||
    casper.fill('form.admin-filter-form', {
 | 
			
		||||
        pattern: '#(?P<id>[0-9]+)',
 | 
			
		||||
        url_format_string: 'https://trac.example.com/ticket/%(id)s'
 | 
			
		||||
        url_format_string: 'https://trac.example.com/ticket/%(id)s',
 | 
			
		||||
    });
 | 
			
		||||
    casper.click('form.admin-filter-form input.btn');
 | 
			
		||||
});
 | 
			
		||||
@@ -202,7 +202,7 @@ casper.waitWhileSelector('.filter_row', function () {
 | 
			
		||||
casper.waitForSelector('.admin-filter-form', function () {
 | 
			
		||||
    casper.fill('form.admin-filter-form', {
 | 
			
		||||
        pattern: 'a$',
 | 
			
		||||
        url_format_string: 'https://trac.example.com/ticket/%(id)s'
 | 
			
		||||
        url_format_string: 'https://trac.example.com/ticket/%(id)s',
 | 
			
		||||
    });
 | 
			
		||||
    casper.click('form.admin-filter-form input.btn');
 | 
			
		||||
});
 | 
			
		||||
@@ -227,7 +227,7 @@ function select_from_suggestions(item) {
 | 
			
		||||
        casper.evaluate(function (item) {
 | 
			
		||||
            var tah = $('.create_default_stream').data().typeahead;
 | 
			
		||||
            tah.mouseenter({
 | 
			
		||||
                currentTarget: $('.typeahead:visible li:contains("'+item+'")')[0]
 | 
			
		||||
                currentTarget: $('.typeahead:visible li:contains("'+item+'")')[0],
 | 
			
		||||
            });
 | 
			
		||||
            tah.select();
 | 
			
		||||
        }, {item: item});
 | 
			
		||||
@@ -281,12 +281,12 @@ var content2 = 'admin: edit test message 2';
 | 
			
		||||
common.then_send_message('stream', {
 | 
			
		||||
    stream:  'Verona',
 | 
			
		||||
    subject: 'edits',
 | 
			
		||||
    content: content1
 | 
			
		||||
    content: content1,
 | 
			
		||||
});
 | 
			
		||||
common.then_send_message('stream', {
 | 
			
		||||
    stream:  'Verona',
 | 
			
		||||
    subject: 'edits',
 | 
			
		||||
    content: content2
 | 
			
		||||
    content: content2,
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
casper.then(function () {
 | 
			
		||||
 
 | 
			
		||||
@@ -263,7 +263,7 @@ activity.presence_info[norbert.user_id] = { status: activity.ACTIVE };
 | 
			
		||||
            num_unread: 0,
 | 
			
		||||
            type: 'active',
 | 
			
		||||
            type_desc: 'is active',
 | 
			
		||||
            mobile: undefined
 | 
			
		||||
            mobile: undefined,
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            name: 'Jill Hill',
 | 
			
		||||
@@ -271,7 +271,7 @@ activity.presence_info[norbert.user_id] = { status: activity.ACTIVE };
 | 
			
		||||
            num_unread: 0,
 | 
			
		||||
            type: 'active',
 | 
			
		||||
            type_desc: 'is active',
 | 
			
		||||
            mobile: undefined
 | 
			
		||||
            mobile: undefined,
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            name: 'Norbert Oswald',
 | 
			
		||||
@@ -279,7 +279,7 @@ activity.presence_info[norbert.user_id] = { status: activity.ACTIVE };
 | 
			
		||||
            num_unread: 0,
 | 
			
		||||
            type: 'active',
 | 
			
		||||
            type_desc: 'is active',
 | 
			
		||||
            mobile: undefined
 | 
			
		||||
            mobile: undefined,
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            name: 'Alice Smith',
 | 
			
		||||
@@ -287,7 +287,7 @@ activity.presence_info[norbert.user_id] = { status: activity.ACTIVE };
 | 
			
		||||
            num_unread: 0,
 | 
			
		||||
            type: 'idle',
 | 
			
		||||
            type_desc: 'is not active',
 | 
			
		||||
            mobile: undefined
 | 
			
		||||
            mobile: undefined,
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            name: 'Marky Mark',
 | 
			
		||||
@@ -295,7 +295,7 @@ activity.presence_info[norbert.user_id] = { status: activity.ACTIVE };
 | 
			
		||||
            num_unread: 0,
 | 
			
		||||
            type: 'idle',
 | 
			
		||||
            type_desc: 'is not active',
 | 
			
		||||
            mobile: undefined
 | 
			
		||||
            mobile: undefined,
 | 
			
		||||
        },
 | 
			
		||||
    ]);
 | 
			
		||||
}());
 | 
			
		||||
@@ -314,8 +314,8 @@ activity.presence_info[norbert.user_id] = { status: activity.ACTIVE };
 | 
			
		||||
        num_unread: 0,
 | 
			
		||||
        type: 'active',
 | 
			
		||||
        type_desc: 'is active',
 | 
			
		||||
        mobile: undefined
 | 
			
		||||
    }, ]);
 | 
			
		||||
        mobile: undefined,
 | 
			
		||||
    } ]);
 | 
			
		||||
 | 
			
		||||
    // Test if user index in presence_info is the expected one
 | 
			
		||||
    var all_users = activity._filter_and_sort(activity.presence_info);
 | 
			
		||||
@@ -331,8 +331,8 @@ activity.presence_info[norbert.user_id] = { status: activity.ACTIVE };
 | 
			
		||||
        num_unread: 0,
 | 
			
		||||
        type: 'active',
 | 
			
		||||
        type_desc: 'is active',
 | 
			
		||||
        mobile: undefined
 | 
			
		||||
    }, ]);
 | 
			
		||||
        mobile: undefined,
 | 
			
		||||
    } ]);
 | 
			
		||||
 | 
			
		||||
    all_users = activity._filter_and_sort(activity.presence_info);
 | 
			
		||||
    assert.equal(all_users.indexOf(mark.user_id.toString()), 3);
 | 
			
		||||
 
 | 
			
		||||
@@ -35,24 +35,24 @@ var editability_types = message_edit.editability_types;
 | 
			
		||||
    // For the rest of these tests, we only consider messages sent by the
 | 
			
		||||
    // user, and that were successfully sent (i.e. no failed_request or local_id)
 | 
			
		||||
    var message = {
 | 
			
		||||
        sent_by_me: true
 | 
			
		||||
        sent_by_me: true,
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    global.page_params = {
 | 
			
		||||
        realm_allow_message_editing: false
 | 
			
		||||
        realm_allow_message_editing: false,
 | 
			
		||||
    };
 | 
			
		||||
    assert.equal(get_editability(message), editability_types.NO);
 | 
			
		||||
 | 
			
		||||
    global.page_params = {
 | 
			
		||||
        realm_allow_message_editing: true,
 | 
			
		||||
        // Limit of 0 means no time limit on editing messages
 | 
			
		||||
        realm_message_content_edit_limit_seconds: 0
 | 
			
		||||
        realm_message_content_edit_limit_seconds: 0,
 | 
			
		||||
    };
 | 
			
		||||
    assert.equal(get_editability(message), editability_types.FULL);
 | 
			
		||||
 | 
			
		||||
    global.page_params = {
 | 
			
		||||
        realm_allow_message_editing: true,
 | 
			
		||||
        realm_message_content_edit_limit_seconds: 10
 | 
			
		||||
        realm_message_content_edit_limit_seconds: 10,
 | 
			
		||||
    };
 | 
			
		||||
    var now = new Date();
 | 
			
		||||
    var current_timestamp = now/1000;
 | 
			
		||||
 
 | 
			
		||||
@@ -26,7 +26,7 @@ var settings = require("js/settings.js");
 | 
			
		||||
(function test_generate_zuliprc_content() {
 | 
			
		||||
    var user = {
 | 
			
		||||
        email: "admin12@chatting.net",
 | 
			
		||||
        api_key: "nSlA0mUm7G42LP85lMv7syqFTzDE2q34"
 | 
			
		||||
        api_key: "nSlA0mUm7G42LP85lMv7syqFTzDE2q34",
 | 
			
		||||
    };
 | 
			
		||||
    var content = settings.generate_zuliprc_content(user.email, user.api_key);
 | 
			
		||||
    var expected = "[api]\nemail=admin12@chatting.net\n" +
 | 
			
		||||
 
 | 
			
		||||
@@ -34,12 +34,12 @@ i18n.init({
 | 
			
		||||
    var poland = {
 | 
			
		||||
        subscribed: true,
 | 
			
		||||
        name: 'Poland',
 | 
			
		||||
        stream_id: 2
 | 
			
		||||
        stream_id: 2,
 | 
			
		||||
    };
 | 
			
		||||
    var pomona = {
 | 
			
		||||
        subscribed: true,
 | 
			
		||||
        name: 'Pomona',
 | 
			
		||||
        stream_id: 3
 | 
			
		||||
        stream_id: 3,
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    var elem_1 = $(global.render_template("subscription", denmark));
 | 
			
		||||
 
 | 
			
		||||
@@ -562,7 +562,7 @@ function render(template_name, args) {
 | 
			
		||||
(function message_reaction() {
 | 
			
		||||
    var args = {
 | 
			
		||||
        emoji_name: 'smile',
 | 
			
		||||
        message_id: '1'
 | 
			
		||||
        message_id: '1',
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    var html = '';
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@ add_dependencies({
 | 
			
		||||
 | 
			
		||||
stream_data.create_streams([
 | 
			
		||||
    {name: 'Dev', subscribed: true, color: 'blue', stream_id: 1},
 | 
			
		||||
    {name: 'Linux', subscribed: true, color: 'red', stream_id: 2}
 | 
			
		||||
    {name: 'Linux', subscribed: true, color: 'red', stream_id: 2},
 | 
			
		||||
]);
 | 
			
		||||
 | 
			
		||||
var matches = [
 | 
			
		||||
@@ -52,7 +52,7 @@ var matches = [
 | 
			
		||||
        is_admin: false,
 | 
			
		||||
        is_bot: false,
 | 
			
		||||
        user_id: 6,
 | 
			
		||||
    }
 | 
			
		||||
    },
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
_.each(matches, function (person) {
 | 
			
		||||
@@ -74,7 +74,7 @@ _.each(matches, function (person) {
 | 
			
		||||
        'b_bot@example.com',
 | 
			
		||||
        'a_user@zulip.org',
 | 
			
		||||
        'zman@test.net',
 | 
			
		||||
        'a_bot@zulip.com'
 | 
			
		||||
        'a_bot@zulip.com',
 | 
			
		||||
     ]);
 | 
			
		||||
 | 
			
		||||
    global.compose.stream_name = function () { return "Dev"; };
 | 
			
		||||
@@ -86,7 +86,7 @@ _.each(matches, function (person) {
 | 
			
		||||
        'b_bot@example.com',
 | 
			
		||||
        'a_user@zulip.org',
 | 
			
		||||
        'zman@test.net',
 | 
			
		||||
        'a_bot@zulip.com'
 | 
			
		||||
        'a_bot@zulip.com',
 | 
			
		||||
    ]);
 | 
			
		||||
 | 
			
		||||
    // No match
 | 
			
		||||
@@ -97,7 +97,7 @@ _.each(matches, function (person) {
 | 
			
		||||
        'b_user_2@zulip.net',
 | 
			
		||||
        'zman@test.net',
 | 
			
		||||
        'a_bot@zulip.com',
 | 
			
		||||
        'b_bot@example.com'
 | 
			
		||||
        'b_bot@example.com',
 | 
			
		||||
    ]);
 | 
			
		||||
 | 
			
		||||
}());
 | 
			
		||||
 
 | 
			
		||||
@@ -26,7 +26,7 @@ function is_mobile(device) {
 | 
			
		||||
 | 
			
		||||
var presence_descriptions = {
 | 
			
		||||
    active: 'is active',
 | 
			
		||||
    idle:   'is not active'
 | 
			
		||||
    idle:   'is not active',
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
/* Keep in sync with views.py:update_active_status_backend() */
 | 
			
		||||
@@ -299,7 +299,7 @@ exports.update_users = function (user_list) {
 | 
			
		||||
            num_unread: get_num_unread(user_id),
 | 
			
		||||
            type: presence,
 | 
			
		||||
            type_desc: presence_descriptions[presence],
 | 
			
		||||
            mobile: exports.presence_info[user_id].mobile
 | 
			
		||||
            mobile: exports.presence_info[user_id].mobile,
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -354,7 +354,7 @@ exports.update_huddles = function () {
 | 
			
		||||
            user_ids_string: huddle,
 | 
			
		||||
            name: exports.full_huddle_name(huddle),
 | 
			
		||||
            fraction_present: exports.huddle_fraction_present(huddle, exports.presence_info),
 | 
			
		||||
            short_name: exports.short_huddle_name(huddle)
 | 
			
		||||
            short_name: exports.short_huddle_name(huddle),
 | 
			
		||||
        };
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
@@ -440,7 +440,7 @@ function focus_ping() {
 | 
			
		||||
            });
 | 
			
		||||
            exports.update_users();
 | 
			
		||||
            exports.update_huddles();
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -138,7 +138,7 @@ exports.update_default_streams_table = function () {
 | 
			
		||||
 | 
			
		||||
function make_stream_default(stream_name) {
 | 
			
		||||
    var data = {
 | 
			
		||||
        stream_name: stream_name
 | 
			
		||||
        stream_name: stream_name,
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    channel.post({
 | 
			
		||||
@@ -151,7 +151,7 @@ function make_stream_default(stream_name) {
 | 
			
		||||
            } else {
 | 
			
		||||
                $(".active_stream_row button").text("Failed!");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -174,8 +174,8 @@ exports.populate_emoji = function (emoji_data) {
 | 
			
		||||
            emoji: {
 | 
			
		||||
                name: name, source_url: data.source_url,
 | 
			
		||||
                display_url: data.display_url,
 | 
			
		||||
                author: data.author
 | 
			
		||||
            }
 | 
			
		||||
                author: data.author,
 | 
			
		||||
            },
 | 
			
		||||
        }));
 | 
			
		||||
    });
 | 
			
		||||
    loading.destroy_indicator($('#admin_page_emoji_loading_indicator'));
 | 
			
		||||
@@ -191,8 +191,8 @@ exports.populate_filters = function (filters_data) {
 | 
			
		||||
                    filter: {
 | 
			
		||||
                        pattern: filter[0],
 | 
			
		||||
                        url_format_string: filter[1],
 | 
			
		||||
                        id: filter[2]
 | 
			
		||||
                    }
 | 
			
		||||
                        id: filter[2],
 | 
			
		||||
                    },
 | 
			
		||||
                }
 | 
			
		||||
            )
 | 
			
		||||
        );
 | 
			
		||||
@@ -226,8 +226,8 @@ exports.populate_auth_methods = function (auth_methods) {
 | 
			
		||||
        auth_methods_table.append(templates.render('admin_auth_methods_list', {
 | 
			
		||||
            method: {
 | 
			
		||||
                method: key,
 | 
			
		||||
                enabled: auth_methods[key]
 | 
			
		||||
            }
 | 
			
		||||
                enabled: auth_methods[key],
 | 
			
		||||
            },
 | 
			
		||||
        }));
 | 
			
		||||
    });
 | 
			
		||||
    loading.destroy_indicator($('#admin_page_auth_methods_loading_indicator'));
 | 
			
		||||
@@ -247,7 +247,7 @@ function _setup_page() {
 | 
			
		||||
            Math.ceil(page_params.realm_message_content_edit_limit_seconds / 60),
 | 
			
		||||
        language_list: page_params.language_list,
 | 
			
		||||
        realm_default_language: page_params.realm_default_language,
 | 
			
		||||
        realm_waiting_period_threshold: page_params.realm_waiting_period_threshold
 | 
			
		||||
        realm_waiting_period_threshold: page_params.realm_waiting_period_threshold,
 | 
			
		||||
    };
 | 
			
		||||
    var admin_tab = templates.render('admin_tab', options);
 | 
			
		||||
    $("#administration").html(admin_tab);
 | 
			
		||||
@@ -284,7 +284,7 @@ function _setup_page() {
 | 
			
		||||
        idempotent: true,
 | 
			
		||||
        timeout:  10*1000,
 | 
			
		||||
        success: populate_users,
 | 
			
		||||
        error: failed_listing_users
 | 
			
		||||
        error: failed_listing_users,
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    // Populate streams table
 | 
			
		||||
@@ -293,7 +293,7 @@ function _setup_page() {
 | 
			
		||||
        timeout:  10*1000,
 | 
			
		||||
        idempotent: true,
 | 
			
		||||
        success: populate_streams,
 | 
			
		||||
        error: failed_listing_streams
 | 
			
		||||
        error: failed_listing_streams,
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    // Populate authentication methods table
 | 
			
		||||
@@ -362,7 +362,7 @@ function _setup_page() {
 | 
			
		||||
            success: function () {
 | 
			
		||||
                var row = $(".active_default_stream_row");
 | 
			
		||||
                row.remove();
 | 
			
		||||
            }
 | 
			
		||||
            },
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
@@ -382,7 +382,7 @@ function _setup_page() {
 | 
			
		||||
        highlight: true,
 | 
			
		||||
        updater: function (stream_name) {
 | 
			
		||||
            make_stream_default(stream_name);
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    $("#do_deactivate_user_button").expectOne().click(function () {
 | 
			
		||||
@@ -413,7 +413,7 @@ function _setup_page() {
 | 
			
		||||
                button.text(i18n.t("Reactivate"));
 | 
			
		||||
                meta.current_deactivate_user_modal_row.addClass("deactivated_user");
 | 
			
		||||
                meta.current_deactivate_user_modal_row.find(".user-admin-settings").hide();
 | 
			
		||||
            }
 | 
			
		||||
            },
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
@@ -444,7 +444,7 @@ function _setup_page() {
 | 
			
		||||
                button.removeClass("deactivate");
 | 
			
		||||
                button.text(i18n.t("Reactivate"));
 | 
			
		||||
                row.addClass("deactivated_user");
 | 
			
		||||
            }
 | 
			
		||||
            },
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
@@ -477,7 +477,7 @@ function _setup_page() {
 | 
			
		||||
                button.removeClass("reactivate");
 | 
			
		||||
                button.text(i18n.t("Deactivate"));
 | 
			
		||||
                row.removeClass("deactivated_user");
 | 
			
		||||
            }
 | 
			
		||||
            },
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
@@ -566,7 +566,7 @@ function _setup_page() {
 | 
			
		||||
            message_content_edit_limit_seconds:
 | 
			
		||||
                JSON.stringify(parseInt(new_message_content_edit_limit_minutes, 10) * 60),
 | 
			
		||||
            default_language: JSON.stringify(new_default_language),
 | 
			
		||||
            waiting_period_threshold: JSON.stringify(parseInt(new_waiting_period_threshold, 10))
 | 
			
		||||
            waiting_period_threshold: JSON.stringify(parseInt(new_waiting_period_threshold, 10)),
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        channel.patch({
 | 
			
		||||
@@ -665,7 +665,7 @@ function _setup_page() {
 | 
			
		||||
                } else {
 | 
			
		||||
                    ui.report_error(i18n.t("Failed!"), xhr, name_status);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            },
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
@@ -679,7 +679,7 @@ function _setup_page() {
 | 
			
		||||
 | 
			
		||||
        var url = "/json/users/" + email;
 | 
			
		||||
        var data = {
 | 
			
		||||
            is_admin: JSON.stringify(true)
 | 
			
		||||
            is_admin: JSON.stringify(true),
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        channel.patch({
 | 
			
		||||
@@ -696,7 +696,7 @@ function _setup_page() {
 | 
			
		||||
            error: function (xhr) {
 | 
			
		||||
                var status = row.find(".admin-user-status");
 | 
			
		||||
                ui.report_error(i18n.t("Failed!"), xhr, status);
 | 
			
		||||
            }
 | 
			
		||||
            },
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
@@ -710,7 +710,7 @@ function _setup_page() {
 | 
			
		||||
 | 
			
		||||
        var url = "/json/users/" + email;
 | 
			
		||||
        var data = {
 | 
			
		||||
            is_admin: JSON.stringify(false)
 | 
			
		||||
            is_admin: JSON.stringify(false),
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        channel.patch({
 | 
			
		||||
@@ -727,7 +727,7 @@ function _setup_page() {
 | 
			
		||||
            error: function (xhr) {
 | 
			
		||||
                var status = row.find(".admin-user-status");
 | 
			
		||||
                ui.report_error(i18n.t("Failed!"), xhr, status);
 | 
			
		||||
            }
 | 
			
		||||
            },
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
@@ -756,7 +756,7 @@ function _setup_page() {
 | 
			
		||||
 | 
			
		||||
            var url = "/json/users/" + email;
 | 
			
		||||
            var data = {
 | 
			
		||||
                full_name: JSON.stringify(full_name.val())
 | 
			
		||||
                full_name: JSON.stringify(full_name.val()),
 | 
			
		||||
            };
 | 
			
		||||
 | 
			
		||||
            channel.patch({
 | 
			
		||||
@@ -765,7 +765,7 @@ function _setup_page() {
 | 
			
		||||
                success: function () {
 | 
			
		||||
                    ui.report_success(i18n.t('Name successfully updated!'), admin_status);
 | 
			
		||||
                },
 | 
			
		||||
                error: failed_changing_name
 | 
			
		||||
                error: failed_changing_name,
 | 
			
		||||
            });
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
@@ -792,7 +792,7 @@ function _setup_page() {
 | 
			
		||||
            success: function () {
 | 
			
		||||
                var row = $(".active_stream_row");
 | 
			
		||||
                row.remove();
 | 
			
		||||
            }
 | 
			
		||||
            },
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
@@ -815,7 +815,7 @@ function _setup_page() {
 | 
			
		||||
            success: function () {
 | 
			
		||||
                var row = btn.parents('tr');
 | 
			
		||||
                row.remove();
 | 
			
		||||
            }
 | 
			
		||||
            },
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
@@ -841,7 +841,7 @@ function _setup_page() {
 | 
			
		||||
                var errors = JSON.parse(xhr.responseText).msg;
 | 
			
		||||
                xhr.responseText = JSON.stringify({msg: errors});
 | 
			
		||||
                ui.report_error(i18n.t("Failed!"), xhr, emoji_status);
 | 
			
		||||
            }
 | 
			
		||||
            },
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
@@ -864,7 +864,7 @@ function _setup_page() {
 | 
			
		||||
            success: function () {
 | 
			
		||||
                var row = btn.parents('tr');
 | 
			
		||||
                row.remove();
 | 
			
		||||
            }
 | 
			
		||||
            },
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
@@ -903,7 +903,7 @@ function _setup_page() {
 | 
			
		||||
                    xhr.responseText = JSON.stringify({msg: errors.__all__});
 | 
			
		||||
                    ui.report_error(i18n.t("Failed"), xhr, filter_status);
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
            },
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
@@ -922,7 +922,7 @@ function _setup_page() {
 | 
			
		||||
                aliases_info.removeClass("text-success");
 | 
			
		||||
                aliases_info.addClass("text-error");
 | 
			
		||||
                aliases_info.text(JSON.parse(xhr.responseText).msg);
 | 
			
		||||
            }
 | 
			
		||||
            },
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
@@ -945,7 +945,7 @@ function _setup_page() {
 | 
			
		||||
                aliases_info.removeClass("text-success");
 | 
			
		||||
                aliases_info.addClass("text-error");
 | 
			
		||||
                aliases_info.text(JSON.parse(xhr.responseText).msg);
 | 
			
		||||
            }
 | 
			
		||||
            },
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@ function is_image_format(file) {
 | 
			
		||||
        'image/jpeg',
 | 
			
		||||
        'image/png',
 | 
			
		||||
        'image/gif',
 | 
			
		||||
        'image/tiff'
 | 
			
		||||
        'image/tiff',
 | 
			
		||||
    ];
 | 
			
		||||
    return _.indexOf(supported_types, type) >= 0;
 | 
			
		||||
}
 | 
			
		||||
@@ -138,7 +138,7 @@ exports.build_widget = function (
 | 
			
		||||
        clear: clear,
 | 
			
		||||
        // Call back to close() when you are truly done with the widget,
 | 
			
		||||
        // so you can release handlers.
 | 
			
		||||
        close: close
 | 
			
		||||
        close: close,
 | 
			
		||||
    };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@@ -162,7 +162,7 @@ exports.build_user_avatar_widget = function (upload_function) {
 | 
			
		||||
              // where you try to upload the same image you just deleted.
 | 
			
		||||
              var file_input = $("#user_avatar_file_input");
 | 
			
		||||
              file_input.replaceWith(file_input.clone(true));
 | 
			
		||||
            }
 | 
			
		||||
            },
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -382,8 +382,8 @@ $(function () {
 | 
			
		||||
            relay_url: "https://webathena.mit.edu/relay.html",
 | 
			
		||||
            params: {
 | 
			
		||||
                realm: "ATHENA.MIT.EDU",
 | 
			
		||||
                principal: principal
 | 
			
		||||
            }
 | 
			
		||||
                principal: principal,
 | 
			
		||||
            },
 | 
			
		||||
        }, function (err, r) {
 | 
			
		||||
            if (err) {
 | 
			
		||||
                blueslip.warn(err);
 | 
			
		||||
@@ -402,7 +402,7 @@ $(function () {
 | 
			
		||||
                },
 | 
			
		||||
                error: function () {
 | 
			
		||||
                    $("#zephyr-mirror-error").show();
 | 
			
		||||
                }
 | 
			
		||||
                },
 | 
			
		||||
            });
 | 
			
		||||
        });
 | 
			
		||||
        $('#settings-dropdown').dropdown("toggle");
 | 
			
		||||
@@ -440,13 +440,13 @@ $(function () {
 | 
			
		||||
            if ($target.parent().hasClass("youtube-video")) {
 | 
			
		||||
                ui.lightbox({
 | 
			
		||||
                    type: "youtube",
 | 
			
		||||
                    id: $target.data("id")
 | 
			
		||||
                    id: $target.data("id"),
 | 
			
		||||
                });
 | 
			
		||||
            } else {
 | 
			
		||||
                ui.lightbox({
 | 
			
		||||
                    type: "photo",
 | 
			
		||||
                    image: img,
 | 
			
		||||
                    user: user
 | 
			
		||||
                    user: user,
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
 
 | 
			
		||||
@@ -22,7 +22,7 @@ exports.toggle = (function () {
 | 
			
		||||
 | 
			
		||||
        var meta = {
 | 
			
		||||
            retrieved: false,
 | 
			
		||||
            $ind_tab: component.find(".ind-tab")
 | 
			
		||||
            $ind_tab: component.find(".ind-tab"),
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        (function () {
 | 
			
		||||
@@ -56,14 +56,14 @@ exports.toggle = (function () {
 | 
			
		||||
            },
 | 
			
		||||
            get: function () {
 | 
			
		||||
                return component;
 | 
			
		||||
            }
 | 
			
		||||
            },
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        if (opts.name) {
 | 
			
		||||
            keys[opts.name] = {
 | 
			
		||||
                opts: opts,
 | 
			
		||||
                component: component,
 | 
			
		||||
                value: prototype.value
 | 
			
		||||
                value: prototype.value,
 | 
			
		||||
            };
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -191,7 +191,7 @@ function update_fade() {
 | 
			
		||||
$(function () {
 | 
			
		||||
    $('#stream,#subject,#private_message_recipient').bind({
 | 
			
		||||
         keyup: update_fade,
 | 
			
		||||
         change: update_fade
 | 
			
		||||
         change: update_fade,
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
@@ -201,7 +201,7 @@ function fill_in_opts_from_current_narrowed_view(msg_type, opts) {
 | 
			
		||||
        stream:           '',
 | 
			
		||||
        subject:          '',
 | 
			
		||||
        private_message_recipient: '',
 | 
			
		||||
        trigger:          'unknown'
 | 
			
		||||
        trigger:          'unknown',
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    // Set default parameters based on the current narrowed view.
 | 
			
		||||
@@ -424,7 +424,7 @@ function send_message_ajax(request, success, error) {
 | 
			
		||||
 | 
			
		||||
            var response = channel.xhr_error_message("Error sending message", xhr);
 | 
			
		||||
            error(response);
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -438,7 +438,7 @@ function report_send_time(send_time, receive_time, display_time, locally_echoed,
 | 
			
		||||
    }
 | 
			
		||||
    channel.post({
 | 
			
		||||
        url: '/json/report_send_time',
 | 
			
		||||
        data: data
 | 
			
		||||
        data: data,
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -751,7 +751,7 @@ exports.check_stream_existence = function (stream_name, autosubscribe) {
 | 
			
		||||
            } else {
 | 
			
		||||
                result = "error";
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
    });
 | 
			
		||||
    return result;
 | 
			
		||||
};
 | 
			
		||||
@@ -1053,7 +1053,7 @@ $(function () {
 | 
			
		||||
                        loading.destroy_indicator($("#markdown_preview_spinner"));
 | 
			
		||||
                    }
 | 
			
		||||
                    $("#preview_content").html(i18n.t("Failed to generate preview"));
 | 
			
		||||
                }
 | 
			
		||||
                },
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
@@ -1076,7 +1076,7 @@ $(function () {
 | 
			
		||||
            // Optional. A value of false (default) limits selection to a single file, while
 | 
			
		||||
            // true enables multiple file selection.
 | 
			
		||||
            multiselect: true,
 | 
			
		||||
            iframe: true
 | 
			
		||||
            iframe: true,
 | 
			
		||||
        };
 | 
			
		||||
        Dropbox.choose(options);
 | 
			
		||||
    });
 | 
			
		||||
@@ -1174,7 +1174,7 @@ $(function () {
 | 
			
		||||
        maxfilesize: page_params.maxfilesize,
 | 
			
		||||
        data: {
 | 
			
		||||
            // the token isn't automatically included in filedrop's post
 | 
			
		||||
            csrfmiddlewaretoken: csrf_token
 | 
			
		||||
            csrfmiddlewaretoken: csrf_token,
 | 
			
		||||
        },
 | 
			
		||||
        raw_droppable: ['text/uri-list', 'text/plain'],
 | 
			
		||||
        drop: uploadStarted,
 | 
			
		||||
@@ -1188,7 +1188,7 @@ $(function () {
 | 
			
		||||
            }
 | 
			
		||||
            textbox.val(textbox.val() + contents);
 | 
			
		||||
            exports.autosize_textarea();
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    if (page_params.narrow !== undefined) {
 | 
			
		||||
 
 | 
			
		||||
@@ -16,7 +16,7 @@ exports.set_focused_recipient = function (msg_type) {
 | 
			
		||||
    // Construct focused_recipient as a mocked up element which has all the
 | 
			
		||||
    // fields of a message used by util.same_recipient()
 | 
			
		||||
    focused_recipient = {
 | 
			
		||||
        type: msg_type
 | 
			
		||||
        type: msg_type,
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    if (focused_recipient.type === "stream") {
 | 
			
		||||
 
 | 
			
		||||
@@ -251,12 +251,12 @@ exports.compose_content_begins_typeahead = function (query) {
 | 
			
		||||
            // Always sort above, under the assumption that names will
 | 
			
		||||
            // be longer and only contain "all" as a substring.
 | 
			
		||||
            pm_recipient_count: Infinity,
 | 
			
		||||
            full_name: "all"
 | 
			
		||||
            full_name: "all",
 | 
			
		||||
        };
 | 
			
		||||
        var everyone_item = {
 | 
			
		||||
            special_item_text: "everyone (Notify everyone)",
 | 
			
		||||
            email: "everyone",
 | 
			
		||||
            full_name: "everyone"
 | 
			
		||||
            full_name: "everyone",
 | 
			
		||||
        };
 | 
			
		||||
        var persons = people.get_realm_persons();
 | 
			
		||||
        return [].concat(persons, [all_item, everyone_item]);
 | 
			
		||||
@@ -349,7 +349,7 @@ exports.initialize_compose_typeahead = function (selector, completions) {
 | 
			
		||||
        },
 | 
			
		||||
        updater: exports.content_typeahead_selected,
 | 
			
		||||
        stopAdvance: true, // Do not advance to the next field on a tab or enter
 | 
			
		||||
        completions: completions
 | 
			
		||||
        completions: completions,
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@@ -378,7 +378,7 @@ exports.initialize = function () {
 | 
			
		||||
        return channel.post({
 | 
			
		||||
            url: '/json/users/me/enter-sends',
 | 
			
		||||
            idempotent: true,
 | 
			
		||||
            data: {enter_sends: page_params.enter_sends}
 | 
			
		||||
            data: {enter_sends: page_params.enter_sends},
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
    $("#enter_sends").prop('checked', page_params.enter_sends);
 | 
			
		||||
@@ -402,7 +402,7 @@ exports.initialize = function () {
 | 
			
		||||
            // because we want to avoid mixing up streams.
 | 
			
		||||
            var q = this.query.trim().toLowerCase();
 | 
			
		||||
            return (item.toLowerCase().indexOf(q) === 0);
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    $( "#subject" ).typeahead({
 | 
			
		||||
@@ -419,7 +419,7 @@ exports.initialize = function () {
 | 
			
		||||
                sorted.unshift(this.query);
 | 
			
		||||
            }
 | 
			
		||||
            return sorted;
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    $( "#private_message_recipient" ).typeahead({
 | 
			
		||||
@@ -459,7 +459,7 @@ exports.initialize = function () {
 | 
			
		||||
            }
 | 
			
		||||
            return previous_recipients + item.email + ", ";
 | 
			
		||||
        },
 | 
			
		||||
        stopAdvance: true // Do not advance to the next field on a tab or enter
 | 
			
		||||
        stopAdvance: true, // Do not advance to the next field on a tab or enter
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    exports.initialize_compose_typeahead("#new_message_content", {mention: true, emoji: true, stream: true});
 | 
			
		||||
 
 | 
			
		||||
@@ -13,8 +13,8 @@ var exports = {};
 | 
			
		||||
        channel.post({
 | 
			
		||||
            url: '/json/users/me/subscriptions',
 | 
			
		||||
            data: {
 | 
			
		||||
                subscriptions: JSON.stringify([{name: stream_name}])
 | 
			
		||||
            }
 | 
			
		||||
                subscriptions: JSON.stringify([{name: stream_name}]),
 | 
			
		||||
            },
 | 
			
		||||
        }).then(
 | 
			
		||||
            function (data) {
 | 
			
		||||
                if (!$.isEmptyObject(data.already_subscribed)) {
 | 
			
		||||
@@ -33,8 +33,8 @@ var exports = {};
 | 
			
		||||
        channel.del({
 | 
			
		||||
            url: '/json/users/me/subscriptions',
 | 
			
		||||
            data: {
 | 
			
		||||
                subscriptions: JSON.stringify([stream_name])
 | 
			
		||||
            }
 | 
			
		||||
                subscriptions: JSON.stringify([stream_name]),
 | 
			
		||||
            },
 | 
			
		||||
        }).then(
 | 
			
		||||
            function () {
 | 
			
		||||
                $status_message.hide();
 | 
			
		||||
 
 | 
			
		||||
@@ -43,7 +43,7 @@ function check_duplicate_ids() {
 | 
			
		||||
                    id: o.id,
 | 
			
		||||
                    count: 1,
 | 
			
		||||
                    node: "<" + tag + " className='" + o.className + "' id='" + o.id + "'>" +
 | 
			
		||||
                          "</" + tag + ">"
 | 
			
		||||
                          "</" + tag + ">",
 | 
			
		||||
                });
 | 
			
		||||
            } else {
 | 
			
		||||
                el.count += 1;
 | 
			
		||||
@@ -55,7 +55,7 @@ function check_duplicate_ids() {
 | 
			
		||||
 | 
			
		||||
    return {
 | 
			
		||||
        collisions: collisions,
 | 
			
		||||
        total_collisions: total_collisions
 | 
			
		||||
        total_collisions: total_collisions,
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -129,5 +129,5 @@ IterationProfiler.prototype = {
 | 
			
		||||
                console.log(prop, this.sections[prop]);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    },
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
@@ -121,7 +121,7 @@ Dict.prototype = {
 | 
			
		||||
        return _.each(this._items, function (mapping) {
 | 
			
		||||
            f(mapping.v, mapping.k);
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
    },
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
}());
 | 
			
		||||
 
 | 
			
		||||
@@ -18,7 +18,7 @@ var bugdown_re = [
 | 
			
		||||
                    /[^\s]*(?:\.bmp|\.gif|\.jpg|\.jpeg|\.png|\.webp)\s+/m,
 | 
			
		||||
                    /[^\s]*(?:\.bmp|\.gif|\.jpg|\.jpeg|\.png|\.webp)$/m,
 | 
			
		||||
                    // Twitter and youtube links are given previews
 | 
			
		||||
                    /[^\s]*(?:twitter|youtube).com\/[^\s]*/
 | 
			
		||||
                    /[^\s]*(?:twitter|youtube).com\/[^\s]*/,
 | 
			
		||||
                  ];
 | 
			
		||||
 | 
			
		||||
exports.contains_bugdown = function contains_bugdown(content) {
 | 
			
		||||
@@ -417,7 +417,7 @@ $(function () {
 | 
			
		||||
    function disable_markdown_regex(rules, name) {
 | 
			
		||||
        rules[name] = {exec: function () {
 | 
			
		||||
                return false;
 | 
			
		||||
            }
 | 
			
		||||
            },
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -500,7 +500,7 @@ $(function () {
 | 
			
		||||
        streamHandler: handleStream,
 | 
			
		||||
        realmFilterHandler: handleRealmFilter,
 | 
			
		||||
        renderer: r,
 | 
			
		||||
        preprocessors: [preprocess_code_blocks]
 | 
			
		||||
        preprocessors: [preprocess_code_blocks],
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    function on_failed_action(action, callback) {
 | 
			
		||||
 
 | 
			
		||||
@@ -18,7 +18,7 @@ var unicode_emoji_names = ["1f198", "1f3ed", "0034", "1f341", "1f3d7", "26f9", "
 | 
			
		||||
emoji_names.push("zulip");
 | 
			
		||||
exports.realm_emojis.zulip = {
 | 
			
		||||
    emoji_name: 'zulip',
 | 
			
		||||
    emoji_url: '/static/third/gemoji/images/emoji/zulip.png'
 | 
			
		||||
    emoji_url: '/static/third/gemoji/images/emoji/zulip.png',
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
_.each(emoji_names, function (value) {
 | 
			
		||||
 
 | 
			
		||||
@@ -87,7 +87,7 @@ exports.process_fenced_code = function (content) {
 | 
			
		||||
                        output_lines.push(text);
 | 
			
		||||
                        output_lines.push('');
 | 
			
		||||
                        handler_stack.pop();
 | 
			
		||||
                    }
 | 
			
		||||
                    },
 | 
			
		||||
                };
 | 
			
		||||
            }
 | 
			
		||||
            return {
 | 
			
		||||
@@ -107,7 +107,7 @@ exports.process_fenced_code = function (content) {
 | 
			
		||||
                    output_lines.push(placeholder);
 | 
			
		||||
                    output_lines.push('');
 | 
			
		||||
                    handler_stack.pop();
 | 
			
		||||
                }
 | 
			
		||||
                },
 | 
			
		||||
            };
 | 
			
		||||
        }());
 | 
			
		||||
    }
 | 
			
		||||
@@ -119,7 +119,7 @@ exports.process_fenced_code = function (content) {
 | 
			
		||||
            },
 | 
			
		||||
            done: function () {
 | 
			
		||||
                handler_stack.pop();
 | 
			
		||||
            }
 | 
			
		||||
            },
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -175,7 +175,7 @@ Filter.canonicalize_term = function (opts) {
 | 
			
		||||
    return {
 | 
			
		||||
        negated: negated,
 | 
			
		||||
        operator: operator,
 | 
			
		||||
        operand: operand
 | 
			
		||||
        operand: operand,
 | 
			
		||||
    };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@@ -373,7 +373,7 @@ Filter.prototype = {
 | 
			
		||||
                return ok;
 | 
			
		||||
            });
 | 
			
		||||
        };
 | 
			
		||||
    }
 | 
			
		||||
    },
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
Filter.operator_to_prefix = function (operator, negated) {
 | 
			
		||||
 
 | 
			
		||||
@@ -146,7 +146,7 @@ function do_hashchange(from_reload) {
 | 
			
		||||
        var narrow_opts = {
 | 
			
		||||
            select_first_unread: true,
 | 
			
		||||
            change_hash:    false,  // already set
 | 
			
		||||
            trigger: 'hash change'
 | 
			
		||||
            trigger: 'hash change',
 | 
			
		||||
        };
 | 
			
		||||
        if (from_reload !== undefined && page_params.initial_narrow_pointer !== undefined) {
 | 
			
		||||
            narrow_opts.from_reload = true;
 | 
			
		||||
@@ -187,7 +187,7 @@ function do_hashchange(from_reload) {
 | 
			
		||||
// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- - -- //
 | 
			
		||||
var ignore = {
 | 
			
		||||
    flag: false,
 | 
			
		||||
    prev: null
 | 
			
		||||
    prev: null,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
function get_main_hash(hash) {
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@ var actions_dropdown_hotkeys = [
 | 
			
		||||
    'up_arrow',
 | 
			
		||||
    'vim_up',
 | 
			
		||||
    'vim_down',
 | 
			
		||||
    'enter'
 | 
			
		||||
    'enter',
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
// Note that multiple keys can map to the same event_name, which
 | 
			
		||||
@@ -22,7 +22,7 @@ var actions_dropdown_hotkeys = [
 | 
			
		||||
var hotkeys_shift = {
 | 
			
		||||
    // these can be triggered by shift + key only
 | 
			
		||||
    9: {name: 'shift_tab', message_view_only: false}, // tab
 | 
			
		||||
    32: {name: 'page_up', message_view_only: true}  // space bar
 | 
			
		||||
    32: {name: 'page_up', message_view_only: true},  // space bar
 | 
			
		||||
};
 | 
			
		||||
var hotkeys_no_modifiers = {
 | 
			
		||||
    // these can be triggered by key only (without shift)
 | 
			
		||||
@@ -33,7 +33,7 @@ var hotkeys_no_modifiers = {
 | 
			
		||||
    35: {name: 'end', message_view_only: true}, // end
 | 
			
		||||
    36: {name: 'home', message_view_only: true}, // home
 | 
			
		||||
    38: {name: 'up_arrow', message_view_only: true}, // up arrow
 | 
			
		||||
    40: {name: 'down_arrow', message_view_only: true} // down arrow
 | 
			
		||||
    40: {name: 'down_arrow', message_view_only: true}, // down arrow
 | 
			
		||||
};
 | 
			
		||||
var hotkeys_shift_insensitive = {
 | 
			
		||||
    // these can be triggered by key or shift + key
 | 
			
		||||
@@ -59,7 +59,7 @@ var hotkeys_shift_insensitive = {
 | 
			
		||||
    114: {name: 'reply_message', message_view_only: true}, // 'r'
 | 
			
		||||
    115: {name: 'narrow_by_recipient', message_view_only: true}, // 's'
 | 
			
		||||
    118: {name: 'narrow_private', message_view_only: true}, // 'v'
 | 
			
		||||
    119: {name: 'query_streams', message_view_only: false} // 'w'
 | 
			
		||||
    119: {name: 'query_streams', message_view_only: false}, // 'w'
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
var tab_up_down = (function () {
 | 
			
		||||
@@ -76,7 +76,7 @@ var tab_up_down = (function () {
 | 
			
		||||
            },
 | 
			
		||||
            prev: function () {
 | 
			
		||||
                return $target.closest("li").prev().find("a");
 | 
			
		||||
            }
 | 
			
		||||
            },
 | 
			
		||||
        };
 | 
			
		||||
    };
 | 
			
		||||
}());
 | 
			
		||||
 
 | 
			
		||||
@@ -110,7 +110,7 @@ exports.initialize = function () {
 | 
			
		||||
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    $(document).on('click', '.invite_check_all_button', function (e) {
 | 
			
		||||
 
 | 
			
		||||
@@ -12,7 +12,7 @@ var editability_types = {
 | 
			
		||||
    // Similar story for messages whose topic you can change only because
 | 
			
		||||
    // you are an admin.
 | 
			
		||||
    TOPIC_ONLY: 3,
 | 
			
		||||
    FULL: 4
 | 
			
		||||
    FULL: 4,
 | 
			
		||||
};
 | 
			
		||||
exports.editability_types = editability_types;
 | 
			
		||||
 | 
			
		||||
@@ -120,7 +120,7 @@ exports.save = function (row, from_topic_edited_only) {
 | 
			
		||||
                var message = channel.xhr_error_message("Error saving edit", xhr);
 | 
			
		||||
                row.find(".edit_error").text(message).show();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
    });
 | 
			
		||||
    // The message will automatically get replaced via message_list.update_message.
 | 
			
		||||
};
 | 
			
		||||
@@ -220,7 +220,7 @@ function edit_message(row, raw_content) {
 | 
			
		||||
            animation: false,
 | 
			
		||||
            placement: 'left',
 | 
			
		||||
            template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div>' +
 | 
			
		||||
                '<div class="tooltip-inner message-edit-tooltip-inner"></div></div>'
 | 
			
		||||
                '<div class="tooltip-inner message-edit-tooltip-inner"></div></div>',
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -313,7 +313,7 @@ exports.start = function (row) {
 | 
			
		||||
                message.raw_content = data.raw_content;
 | 
			
		||||
                start_edit_maintaining_scroll(row, data.raw_content);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -31,7 +31,7 @@ function batched_updater(flag, op, immediate) {
 | 
			
		||||
            data:     {messages: JSON.stringify(real_msg_ids),
 | 
			
		||||
                       op:       op,
 | 
			
		||||
                       flag:     flag},
 | 
			
		||||
            success:  on_success
 | 
			
		||||
            success:  on_success,
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -7,7 +7,7 @@ exports.narrowed = undefined;
 | 
			
		||||
exports.MessageList = function (table_name, filter, opts) {
 | 
			
		||||
    _.extend(this, {
 | 
			
		||||
        collapse_messages: true,
 | 
			
		||||
        muting_enabled: true
 | 
			
		||||
        muting_enabled: true,
 | 
			
		||||
    }, opts);
 | 
			
		||||
    this.view = new MessageListView(this, table_name, this.collapse_messages);
 | 
			
		||||
 | 
			
		||||
@@ -150,11 +150,11 @@ exports.MessageList.prototype = {
 | 
			
		||||
                use_closest: false,
 | 
			
		||||
                empty_ok: false,
 | 
			
		||||
                mark_read: true,
 | 
			
		||||
                force_rerender: false
 | 
			
		||||
                force_rerender: false,
 | 
			
		||||
            }, opts, {
 | 
			
		||||
                id: id,
 | 
			
		||||
                msg_list: this,
 | 
			
		||||
                previously_selected: this._selected_id
 | 
			
		||||
                previously_selected: this._selected_id,
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
        id = parseFloat(id);
 | 
			
		||||
@@ -179,7 +179,7 @@ exports.MessageList.prototype = {
 | 
			
		||||
            var error_data = {
 | 
			
		||||
                table_name: this.table_name,
 | 
			
		||||
                id: id,
 | 
			
		||||
                items_length: this._items.length
 | 
			
		||||
                items_length: this._items.length,
 | 
			
		||||
            };
 | 
			
		||||
            blueslip.fatal("Cannot select id -1", error_data);
 | 
			
		||||
        }
 | 
			
		||||
@@ -621,7 +621,7 @@ exports.MessageList.prototype = {
 | 
			
		||||
                }
 | 
			
		||||
            }
 | 
			
		||||
        }, 0);
 | 
			
		||||
    }
 | 
			
		||||
    },
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports.all = new exports.MessageList(
 | 
			
		||||
 
 | 
			
		||||
@@ -130,7 +130,7 @@ MessageListView.prototype = {
 | 
			
		||||
        function start_group() {
 | 
			
		||||
            return {
 | 
			
		||||
                message_containers: [],
 | 
			
		||||
                message_group_id: _.uniqueId('message_group_')
 | 
			
		||||
                message_group_id: _.uniqueId('message_group_'),
 | 
			
		||||
            };
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -280,7 +280,7 @@ MessageListView.prototype = {
 | 
			
		||||
            prepend_groups: [],
 | 
			
		||||
            rerender_groups: [],
 | 
			
		||||
            append_messages: [],
 | 
			
		||||
            rerender_messages: []
 | 
			
		||||
            rerender_messages: [],
 | 
			
		||||
        };
 | 
			
		||||
        var first_group;
 | 
			
		||||
        var second_group;
 | 
			
		||||
@@ -446,7 +446,7 @@ MessageListView.prototype = {
 | 
			
		||||
            rendered_groups = $(templates.render('message_group', {
 | 
			
		||||
                message_groups: message_actions.prepend_groups,
 | 
			
		||||
                use_match_properties: self.list.filter.is_search(),
 | 
			
		||||
                table_name: self.table_name
 | 
			
		||||
                table_name: self.table_name,
 | 
			
		||||
            }));
 | 
			
		||||
 | 
			
		||||
            dom_messages = rendered_groups.find('.message_row');
 | 
			
		||||
@@ -473,7 +473,7 @@ MessageListView.prototype = {
 | 
			
		||||
                rendered_groups = $(templates.render('message_group', {
 | 
			
		||||
                    message_groups: [message_group],
 | 
			
		||||
                    use_match_properties: self.list.filter.is_search(),
 | 
			
		||||
                    table_name: self.table_name
 | 
			
		||||
                    table_name: self.table_name,
 | 
			
		||||
                }));
 | 
			
		||||
 | 
			
		||||
                dom_messages = rendered_groups.find('.message_row');
 | 
			
		||||
@@ -529,7 +529,7 @@ MessageListView.prototype = {
 | 
			
		||||
            rendered_groups = $(templates.render('message_group', {
 | 
			
		||||
                message_groups: message_actions.append_groups,
 | 
			
		||||
                use_match_properties: self.list.filter.is_search(),
 | 
			
		||||
                table_name: self.table_name
 | 
			
		||||
                table_name: self.table_name,
 | 
			
		||||
            }));
 | 
			
		||||
 | 
			
		||||
            dom_messages = rendered_groups.find('.message_row');
 | 
			
		||||
@@ -896,7 +896,7 @@ MessageListView.prototype = {
 | 
			
		||||
        var rendered_trailing_bookend = $(templates.render('bookend', {
 | 
			
		||||
            bookend_content: trailing_bookend_content,
 | 
			
		||||
            trailing: true,
 | 
			
		||||
            subscribed: subscribed
 | 
			
		||||
            subscribed: subscribed,
 | 
			
		||||
        }));
 | 
			
		||||
        rows.get_table(this.table_name).append(rendered_trailing_bookend);
 | 
			
		||||
    },
 | 
			
		||||
@@ -936,7 +936,7 @@ MessageListView.prototype = {
 | 
			
		||||
        } else {
 | 
			
		||||
            message_container.status_message = false;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    },
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
}());
 | 
			
		||||
 
 | 
			
		||||
@@ -267,7 +267,7 @@ exports.update_messages = function update_messages(events) {
 | 
			
		||||
                            var operators = new_filter.operators();
 | 
			
		||||
                            var opts = {
 | 
			
		||||
                                trigger: 'topic change',
 | 
			
		||||
                                then_select_id: current_id
 | 
			
		||||
                                then_select_id: current_id,
 | 
			
		||||
                            };
 | 
			
		||||
                            narrow.activate(operators, opts);
 | 
			
		||||
                            changed_narrow = true;
 | 
			
		||||
@@ -496,7 +496,7 @@ exports.load_old_messages = function load_old_messages(opts) {
 | 
			
		||||
            setTimeout(function () {
 | 
			
		||||
                exports.load_old_messages(opts);
 | 
			
		||||
            }, 5000);
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@@ -529,7 +529,7 @@ exports.load_more_messages = function load_more_messages(msg_list) {
 | 
			
		||||
            if (messages.length >= batch_size) {
 | 
			
		||||
                load_more_enabled = true;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@@ -561,7 +561,7 @@ util.execute_early(function () {
 | 
			
		||||
                    num_before: 0,
 | 
			
		||||
                    num_after: 400,
 | 
			
		||||
                    msg_list: home_msg_list,
 | 
			
		||||
                    cont: load_more
 | 
			
		||||
                    cont: load_more,
 | 
			
		||||
                });
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
@@ -578,7 +578,7 @@ util.execute_early(function () {
 | 
			
		||||
                                  anchor: first_id,
 | 
			
		||||
                                  num_before: backfill_batch_size,
 | 
			
		||||
                                  num_after: 0,
 | 
			
		||||
                                  msg_list: home_msg_list
 | 
			
		||||
                                  msg_list: home_msg_list,
 | 
			
		||||
                              });
 | 
			
		||||
                          }});
 | 
			
		||||
    }
 | 
			
		||||
@@ -589,7 +589,7 @@ util.execute_early(function () {
 | 
			
		||||
            num_before: 200,
 | 
			
		||||
            num_after: 200,
 | 
			
		||||
            msg_list: home_msg_list,
 | 
			
		||||
            cont: load_more
 | 
			
		||||
            cont: load_more,
 | 
			
		||||
        });
 | 
			
		||||
    } else {
 | 
			
		||||
        server_events.home_view_loaded();
 | 
			
		||||
 
 | 
			
		||||
@@ -22,7 +22,7 @@ exports.notify_with_undo_option = (function () {
 | 
			
		||||
        topic: null,
 | 
			
		||||
        hide_me_time: null,
 | 
			
		||||
        alert_hover_state: false,
 | 
			
		||||
        $mute: null
 | 
			
		||||
        $mute: null,
 | 
			
		||||
    };
 | 
			
		||||
    var animate = {
 | 
			
		||||
        fadeOut: function () {
 | 
			
		||||
@@ -34,7 +34,7 @@ exports.notify_with_undo_option = (function () {
 | 
			
		||||
            if (meta.$mute) {
 | 
			
		||||
                meta.$mute.fadeIn(500).addClass("show");
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
    };
 | 
			
		||||
    setInterval(function () {
 | 
			
		||||
        if (meta.hide_me_time < new Date().getTime() && !meta.alert_hover_state) {
 | 
			
		||||
@@ -92,13 +92,13 @@ exports.persist_and_rerender = function () {
 | 
			
		||||
    // die down before the next reload anyway, making the muting moot.
 | 
			
		||||
    exports.rerender();
 | 
			
		||||
    var data = {
 | 
			
		||||
        muted_topics: JSON.stringify(muting.get_muted_topics())
 | 
			
		||||
        muted_topics: JSON.stringify(muting.get_muted_topics()),
 | 
			
		||||
    };
 | 
			
		||||
    last_topic_update = timestamp_ms();
 | 
			
		||||
    channel.post({
 | 
			
		||||
        url: '/json/set_muted_topics',
 | 
			
		||||
        idempotent: true,
 | 
			
		||||
        data: data
 | 
			
		||||
        data: data,
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -113,7 +113,7 @@ function report_narrow_time(initial_core_time, initial_free_time, network_time)
 | 
			
		||||
        url: '/json/report_narrow_time',
 | 
			
		||||
        data: {initial_core: initial_core_time.toString(),
 | 
			
		||||
               initial_free: initial_free_time.toString(),
 | 
			
		||||
               network: network_time.toString()}
 | 
			
		||||
               network: network_time.toString()},
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -142,7 +142,7 @@ function report_unnarrow_time() {
 | 
			
		||||
    channel.post({
 | 
			
		||||
        url: '/json/report_unnarrow_time',
 | 
			
		||||
        data: {initial_core: initial_core_time.toString(),
 | 
			
		||||
               initial_free: initial_free_time.toString()}
 | 
			
		||||
               initial_free: initial_free_time.toString()},
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    unnarrow_times = {};
 | 
			
		||||
@@ -198,7 +198,7 @@ exports.activate = function (raw_operators, opts) {
 | 
			
		||||
        first_unread_from_server: false,
 | 
			
		||||
        from_reload: false,
 | 
			
		||||
        change_hash: true,
 | 
			
		||||
        trigger: 'unknown'
 | 
			
		||||
        trigger: 'unknown',
 | 
			
		||||
    });
 | 
			
		||||
    if (filter.has_operator("near")) {
 | 
			
		||||
        opts.then_select_id = parseInt(filter.operands("near")[0], 10);
 | 
			
		||||
@@ -241,7 +241,7 @@ exports.activate = function (raw_operators, opts) {
 | 
			
		||||
                selected_idx_exact: current_msg_list._items.indexOf(
 | 
			
		||||
                                        current_msg_list.get(current_msg_list.selected_id())),
 | 
			
		||||
                render_start: current_msg_list.view._render_win_start,
 | 
			
		||||
                render_end: current_msg_list.view._render_win_end
 | 
			
		||||
                render_end: current_msg_list.view._render_win_end,
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        current_msg_list.pre_narrow_offset = current_msg_list.selected_row().offset().top;
 | 
			
		||||
@@ -257,7 +257,7 @@ exports.activate = function (raw_operators, opts) {
 | 
			
		||||
 | 
			
		||||
    var msg_list = new message_list.MessageList('zfilt', current_filter, {
 | 
			
		||||
        collapse_messages: ! current_filter.is_search(),
 | 
			
		||||
        muting_enabled: muting_enabled
 | 
			
		||||
        muting_enabled: muting_enabled,
 | 
			
		||||
    });
 | 
			
		||||
    msg_list.start_time = start_time;
 | 
			
		||||
 | 
			
		||||
@@ -292,7 +292,7 @@ exports.activate = function (raw_operators, opts) {
 | 
			
		||||
 | 
			
		||||
            message_list.narrowed.select_id(then_select_id, {then_scroll: then_scroll,
 | 
			
		||||
                                                         use_closest: true,
 | 
			
		||||
                                                         force_rerender: true
 | 
			
		||||
                                                         force_rerender: true,
 | 
			
		||||
                                                        });
 | 
			
		||||
 | 
			
		||||
            if (preserve_pre_narrowing_screen_position) {
 | 
			
		||||
@@ -327,7 +327,7 @@ exports.activate = function (raw_operators, opts) {
 | 
			
		||||
            msg_list.network_time = new Date();
 | 
			
		||||
            maybe_report_narrow_time(msg_list);
 | 
			
		||||
        },
 | 
			
		||||
        cont_will_add_messages: false
 | 
			
		||||
        cont_will_add_messages: false,
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    if (! defer_selecting_closest) {
 | 
			
		||||
@@ -384,7 +384,7 @@ exports.by_subject = function (target_id, opts) {
 | 
			
		||||
    unread.mark_message_as_read(original);
 | 
			
		||||
    var search_terms = [
 | 
			
		||||
        {operator: 'stream', operand: original.stream},
 | 
			
		||||
        {operator: 'topic', operand: original.subject}
 | 
			
		||||
        {operator: 'topic', operand: original.subject},
 | 
			
		||||
    ];
 | 
			
		||||
    opts = _.defaults({}, opts, {then_select_id: target_id});
 | 
			
		||||
    exports.activate(search_terms, opts);
 | 
			
		||||
@@ -472,7 +472,7 @@ exports.deactivate = function () {
 | 
			
		||||
        var select_opts = {
 | 
			
		||||
            then_scroll: true,
 | 
			
		||||
            use_closest: true,
 | 
			
		||||
            empty_ok: true
 | 
			
		||||
            empty_ok: true,
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        // We fall back to the closest selected id, if the user has removed a
 | 
			
		||||
 
 | 
			
		||||
@@ -36,7 +36,7 @@ if (window.webkitNotifications) {
 | 
			
		||||
            notification_object.show = function () {};
 | 
			
		||||
            notification_object.cancel = function () { notification_object.close(); };
 | 
			
		||||
            return notification_object;
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
    };
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -229,17 +229,17 @@ function in_browser_notify(message, title, content, raw_operators, opts) {
 | 
			
		||||
 | 
			
		||||
    $(".top-right").notify({
 | 
			
		||||
        message: {
 | 
			
		||||
            html: notification_html
 | 
			
		||||
            html: notification_html,
 | 
			
		||||
        },
 | 
			
		||||
        fadeOut: {
 | 
			
		||||
            enabled: true,
 | 
			
		||||
            delay: 4000
 | 
			
		||||
        }
 | 
			
		||||
            delay: 4000,
 | 
			
		||||
        },
 | 
			
		||||
    }).show();
 | 
			
		||||
 | 
			
		||||
    $(".notification[data-message-id='" + message.id + "']").expectOne().data("narrow", {
 | 
			
		||||
        raw_operators: raw_operators,
 | 
			
		||||
        opts_notif: opts
 | 
			
		||||
        opts_notif: opts,
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -345,7 +345,7 @@ function process_notification(notification) {
 | 
			
		||||
            obj: notifications_api.createNotification(
 | 
			
		||||
                    icon_url, title, content, message.id),
 | 
			
		||||
            msg_count: msg_count,
 | 
			
		||||
            message_id: message.id
 | 
			
		||||
            message_id: message.id,
 | 
			
		||||
        };
 | 
			
		||||
        notification_object = notice_memory[key].obj;
 | 
			
		||||
        notification_object.onclick = function () {
 | 
			
		||||
@@ -365,7 +365,7 @@ function process_notification(notification) {
 | 
			
		||||
                notification_object = new Notification(title, {
 | 
			
		||||
                    body: content,
 | 
			
		||||
                    iconUrl: ui.small_avatar_url(message),
 | 
			
		||||
                    tag: message.id
 | 
			
		||||
                    tag: message.id,
 | 
			
		||||
                });
 | 
			
		||||
            } else {
 | 
			
		||||
                in_browser_notify(message, title, content, raw_operators, opts);
 | 
			
		||||
 
 | 
			
		||||
@@ -258,7 +258,7 @@ exports.extract_people_from_message = function (message) {
 | 
			
		||||
                    user_id: person.user_id || person.id,
 | 
			
		||||
                    full_name: person.full_name,
 | 
			
		||||
                    is_admin: person.is_realm_admin || false,
 | 
			
		||||
                    is_bot: person.is_bot || false
 | 
			
		||||
                    is_bot: person.is_bot || false,
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
@@ -314,7 +314,7 @@ exports.update = function update(person) {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        $(".inline_profile_picture.u-" + person.id).css({
 | 
			
		||||
          "background-image": "url(" + url + ")"
 | 
			
		||||
          "background-image": "url(" + url + ")",
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
@@ -113,7 +113,7 @@ exports._build_private_messages_list = function (active_conversation, max_privat
 | 
			
		||||
            unread: num_unread,
 | 
			
		||||
            is_zero: num_unread === 0,
 | 
			
		||||
            zoom_out_hide: !always_visible,
 | 
			
		||||
            url: narrow.pm_with_uri(reply_to)
 | 
			
		||||
            url: narrow.pm_with_uri(reply_to),
 | 
			
		||||
        };
 | 
			
		||||
        display_messages.push(display_message);
 | 
			
		||||
    });
 | 
			
		||||
 
 | 
			
		||||
@@ -28,7 +28,7 @@ function update_pointer() {
 | 
			
		||||
            },
 | 
			
		||||
            error: function () {
 | 
			
		||||
                pointer_update_in_flight = false;
 | 
			
		||||
            }
 | 
			
		||||
            },
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
    // Return an empty, resolved Deferred.
 | 
			
		||||
@@ -72,7 +72,7 @@ exports.fast_forward_pointer = function () {
 | 
			
		||||
                                     save_compose: true});
 | 
			
		||||
                });
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -29,7 +29,7 @@ function show_message_info_popover(element, id) {
 | 
			
		||||
            message:  message,
 | 
			
		||||
            pm_with_uri: narrow.pm_with_uri(message.sender_email),
 | 
			
		||||
            sent_by_uri: narrow.by_sender_uri(message.sender_email),
 | 
			
		||||
            narrowed: narrow.active()
 | 
			
		||||
            narrowed: narrow.active(),
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        var ypos = elt.offset().top - viewport.scrollTop();
 | 
			
		||||
@@ -37,7 +37,7 @@ function show_message_info_popover(element, id) {
 | 
			
		||||
            placement: (ypos > (viewport.height() - 300)) ? 'top' : 'bottom',
 | 
			
		||||
            title:     templates.render('message_info_popover_title',   args),
 | 
			
		||||
            content:   templates.render('message_info_popover_content', args),
 | 
			
		||||
            trigger:   "manual"
 | 
			
		||||
            trigger:   "manual",
 | 
			
		||||
        });
 | 
			
		||||
        elt.popover("show");
 | 
			
		||||
        current_message_info_popover_elem = elt;
 | 
			
		||||
@@ -65,7 +65,7 @@ exports.toggle_reactions_popover = function (element, id) {
 | 
			
		||||
            emojis[realm_emoji_name] = {
 | 
			
		||||
                name: realm_emoji_name,
 | 
			
		||||
                is_realm_emoji: true,
 | 
			
		||||
                url: realm_emoji.emoji_url
 | 
			
		||||
                url: realm_emoji.emoji_url,
 | 
			
		||||
            };
 | 
			
		||||
        });
 | 
			
		||||
        _.each(emojis_used, function (emoji_name) {
 | 
			
		||||
@@ -76,7 +76,7 @@ exports.toggle_reactions_popover = function (element, id) {
 | 
			
		||||
                has_reacted: true,
 | 
			
		||||
                css_class: emoji.emoji_name_to_css_class(emoji_name),
 | 
			
		||||
                is_realm_emoji: is_realm_emoji,
 | 
			
		||||
                url: url
 | 
			
		||||
                url: url,
 | 
			
		||||
            };
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
@@ -108,7 +108,7 @@ exports.toggle_reactions_popover = function (element, id) {
 | 
			
		||||
            placement: placement,
 | 
			
		||||
            title:     "",
 | 
			
		||||
            content:   templates.render('reaction_popover_content', args),
 | 
			
		||||
            trigger:   "manual"
 | 
			
		||||
            trigger:   "manual",
 | 
			
		||||
        });
 | 
			
		||||
        elt.popover("show");
 | 
			
		||||
        elt.prop('title', 'Add reaction...');
 | 
			
		||||
@@ -162,7 +162,7 @@ exports.toggle_actions_popover = function (element, id) {
 | 
			
		||||
            can_unmute_topic: can_unmute_topic,
 | 
			
		||||
            should_display_add_reaction_option: message.sent_by_me,
 | 
			
		||||
            conversation_time_uri: narrow.by_conversation_and_time_uri(message),
 | 
			
		||||
            narrowed: narrow.active()
 | 
			
		||||
            narrowed: narrow.active(),
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        var ypos = elt.offset().top - viewport.scrollTop();
 | 
			
		||||
@@ -170,7 +170,7 @@ exports.toggle_actions_popover = function (element, id) {
 | 
			
		||||
            placement: (ypos > (viewport.height() - 300)) ? 'top' : 'bottom',
 | 
			
		||||
            title:     "",
 | 
			
		||||
            content:   templates.render('actions_popover_content', args),
 | 
			
		||||
            trigger:   "manual"
 | 
			
		||||
            trigger:   "manual",
 | 
			
		||||
        });
 | 
			
		||||
        elt.popover("show");
 | 
			
		||||
        current_actions_popover_elem = elt;
 | 
			
		||||
@@ -239,7 +239,7 @@ exports.topic_ops = {
 | 
			
		||||
        popovers.hide_topic_sidebar_popover();
 | 
			
		||||
        muting.unmute_topic(stream, topic);
 | 
			
		||||
        muting_ui.persist_and_rerender();
 | 
			
		||||
    }
 | 
			
		||||
    },
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
function message_info_popped() {
 | 
			
		||||
@@ -347,7 +347,7 @@ exports.hide_user_sidebar_popover = function () {
 | 
			
		||||
 | 
			
		||||
function render_emoji_popover() {
 | 
			
		||||
    var content = templates.render('emoji_popover_content', {
 | 
			
		||||
        emoji_list: emoji.emojis_name_to_css_class
 | 
			
		||||
        emoji_list: emoji.emojis_name_to_css_class,
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    $('.emoji_popover').append(content);
 | 
			
		||||
@@ -397,11 +397,11 @@ exports.register_click_handlers = function () {
 | 
			
		||||
        var meta = {
 | 
			
		||||
          drag: false,
 | 
			
		||||
          c: {
 | 
			
		||||
            y: null
 | 
			
		||||
            y: null,
 | 
			
		||||
          },
 | 
			
		||||
          $popover: $(".emoji_popover"),
 | 
			
		||||
          MIN_HEIGHT: 25,
 | 
			
		||||
          MAX_HEIGHT: 300
 | 
			
		||||
          MAX_HEIGHT: 300,
 | 
			
		||||
        };
 | 
			
		||||
 | 
			
		||||
        // drag must start within the .drag zone.
 | 
			
		||||
@@ -545,7 +545,7 @@ exports.register_click_handlers = function () {
 | 
			
		||||
            content:   content,
 | 
			
		||||
            placement: userlist_placement === "left" ? "right" : "left",
 | 
			
		||||
            trigger:   "manual",
 | 
			
		||||
            fixed: true
 | 
			
		||||
            fixed: true,
 | 
			
		||||
        });
 | 
			
		||||
        target.popover("show");
 | 
			
		||||
        current_user_sidebar_user_id = user_id;
 | 
			
		||||
@@ -578,13 +578,13 @@ exports.register_click_handlers = function () {
 | 
			
		||||
            stream_name: stream_name,
 | 
			
		||||
            topic_name: topic_name,
 | 
			
		||||
            can_mute_topic: can_mute_topic,
 | 
			
		||||
            can_unmute_topic: can_unmute_topic
 | 
			
		||||
            can_unmute_topic: can_unmute_topic,
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        $(elt).popover({
 | 
			
		||||
            content: content,
 | 
			
		||||
            trigger: "manual",
 | 
			
		||||
            fixed: true
 | 
			
		||||
            fixed: true,
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        $(elt).popover("show");
 | 
			
		||||
@@ -602,7 +602,7 @@ exports.register_click_handlers = function () {
 | 
			
		||||
 | 
			
		||||
        var operators = [
 | 
			
		||||
            {operator: 'stream', operand: stream_name},
 | 
			
		||||
            {operator: 'topic', operand: topic_name}
 | 
			
		||||
            {operator: 'topic', operand: topic_name},
 | 
			
		||||
        ];
 | 
			
		||||
        var opts = {select_first_unread: true, trigger: 'sidebar'};
 | 
			
		||||
        narrow.activate(operators, opts);
 | 
			
		||||
@@ -652,7 +652,7 @@ exports.register_click_handlers = function () {
 | 
			
		||||
        $(elt).popover({
 | 
			
		||||
            content:   templates.render('stream_sidebar_actions', {stream: stream_data.get_sub(stream)}),
 | 
			
		||||
            trigger:   "manual",
 | 
			
		||||
            fixed: true
 | 
			
		||||
            fixed: true,
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        // This little function is a workaround for the fact that
 | 
			
		||||
 
 | 
			
		||||
@@ -18,7 +18,7 @@ $(function () {
 | 
			
		||||
    $('#registration, #password_reset').validate({
 | 
			
		||||
        rules: {
 | 
			
		||||
            password:      'password_strength',
 | 
			
		||||
            new_password1: 'password_strength'
 | 
			
		||||
            new_password1: 'password_strength',
 | 
			
		||||
        },
 | 
			
		||||
        errorElement: "p",
 | 
			
		||||
        errorPlacement: function (error, element) {
 | 
			
		||||
@@ -27,7 +27,7 @@ $(function () {
 | 
			
		||||
            error.insertAfter(element).addClass('help-inline');
 | 
			
		||||
        },
 | 
			
		||||
        highlight:   highlight('error'),
 | 
			
		||||
        unhighlight: highlight('success')
 | 
			
		||||
        unhighlight: highlight('success'),
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    $('#id_password, #id_new_password1').on('change keyup', function () {
 | 
			
		||||
@@ -45,11 +45,11 @@ $(function () {
 | 
			
		||||
        },
 | 
			
		||||
        success: function () {
 | 
			
		||||
            $('#errors').empty();
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    $("#login_form").validate({
 | 
			
		||||
        errorClass: "text-error",
 | 
			
		||||
        wrapper: "div"
 | 
			
		||||
        wrapper: "div",
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@ function populate_messages_sent_to_realm(data) {
 | 
			
		||||
        y: data.humans,
 | 
			
		||||
        mode: 'lines',
 | 
			
		||||
        name: 'Messages from humans',
 | 
			
		||||
        hoverinfo: 'y'
 | 
			
		||||
        hoverinfo: 'y',
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    var trace_bots = {
 | 
			
		||||
@@ -16,7 +16,7 @@ function populate_messages_sent_to_realm(data) {
 | 
			
		||||
        y: data.bots,
 | 
			
		||||
        mode: 'lines',
 | 
			
		||||
        name: 'Messages from bots',
 | 
			
		||||
        hoverinfo: 'y'
 | 
			
		||||
        hoverinfo: 'y',
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    var layout = {
 | 
			
		||||
@@ -27,7 +27,7 @@ function populate_messages_sent_to_realm(data) {
 | 
			
		||||
        yaxis: {
 | 
			
		||||
            fixedrange: true,
 | 
			
		||||
            rangemode: 'tozero',
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    Plotly.newPlot('id_messages_sent_to_realm', [trace_humans, trace_bots], layout, {displayModeBar: false});
 | 
			
		||||
@@ -42,5 +42,5 @@ $.get({
 | 
			
		||||
    },
 | 
			
		||||
    error: function (xhr) {
 | 
			
		||||
        $('#id_stats_errors').text($.parseJSON(xhr.responseText).msg);
 | 
			
		||||
    }
 | 
			
		||||
    },
 | 
			
		||||
});
 | 
			
		||||
 
 | 
			
		||||
@@ -13,7 +13,7 @@ function send_reaction_ajax(message_id, emoji_name, operation) {
 | 
			
		||||
        error: function (xhr) {
 | 
			
		||||
            var response = channel.xhr_error_message("Error sending reaction", xhr);
 | 
			
		||||
            blueslip.error(response);
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
    };
 | 
			
		||||
    if (operation === 'add') {
 | 
			
		||||
        channel.put(args);
 | 
			
		||||
@@ -179,7 +179,7 @@ exports.get_message_reactions = function (message) {
 | 
			
		||||
            emoji_name: item[0],
 | 
			
		||||
            emoji_name_css_class: emoji.emoji_name_to_css_class(item[0]),
 | 
			
		||||
            count: item[1].length,
 | 
			
		||||
            title: generate_title(item[0], item[1])
 | 
			
		||||
            title: generate_title(item[0], item[1]),
 | 
			
		||||
        };
 | 
			
		||||
        if (emoji.realm_emojis[reaction.emoji_name]) {
 | 
			
		||||
            reaction.is_realm_emoji = true;
 | 
			
		||||
 
 | 
			
		||||
@@ -77,7 +77,7 @@ $(function () {
 | 
			
		||||
                    // We ignore errors from the server because
 | 
			
		||||
                    // they're unlikely and we'll get an email either
 | 
			
		||||
                    // way
 | 
			
		||||
                }
 | 
			
		||||
                },
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
            show_and_fade_elem($("#tell-a-friend-success"));
 | 
			
		||||
@@ -90,7 +90,7 @@ $(function () {
 | 
			
		||||
        showErrors: function () {
 | 
			
		||||
            this.defaultShowErrors();
 | 
			
		||||
            resize.resize_page_components();
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    $("#referral-form input").on('blur', function () {
 | 
			
		||||
 
 | 
			
		||||
@@ -196,7 +196,7 @@ exports.initiate = function (options) {
 | 
			
		||||
        save_pointer: true,
 | 
			
		||||
        save_narrow: true,
 | 
			
		||||
        save_compose: true,
 | 
			
		||||
        send_after_reload: false
 | 
			
		||||
        send_after_reload: false,
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    if (options.save_pointer === undefined ||
 | 
			
		||||
 
 | 
			
		||||
@@ -33,11 +33,11 @@ function set_user_list_heights(res, usable_height, user_presences, group_pms) {
 | 
			
		||||
    //    res.group_pms_max_height
 | 
			
		||||
    var blocks = [
 | 
			
		||||
        {
 | 
			
		||||
            real_height: user_presences.prop('scrollHeight')
 | 
			
		||||
            real_height: user_presences.prop('scrollHeight'),
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            real_height: group_pms.prop('scrollHeight')
 | 
			
		||||
        }
 | 
			
		||||
            real_height: group_pms.prop('scrollHeight'),
 | 
			
		||||
        },
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    size_blocks(blocks, usable_height);
 | 
			
		||||
@@ -143,14 +143,14 @@ function left_userlist_get_new_heights() {
 | 
			
		||||
 | 
			
		||||
    var blocks = [
 | 
			
		||||
        {
 | 
			
		||||
            real_height: stream_filters_real_height
 | 
			
		||||
            real_height: stream_filters_real_height,
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            real_height: user_list_real_height
 | 
			
		||||
            real_height: user_list_real_height,
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            real_height: group_pms_real_height
 | 
			
		||||
        }
 | 
			
		||||
            real_height: group_pms_real_height,
 | 
			
		||||
        },
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    size_blocks(blocks, res.total_leftlist_height);
 | 
			
		||||
 
 | 
			
		||||
@@ -51,7 +51,7 @@ exports.id = function (message_row) {
 | 
			
		||||
 | 
			
		||||
var valid_table_names = {
 | 
			
		||||
    zhome: true,
 | 
			
		||||
    zfilt: true
 | 
			
		||||
    zfilt: true,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports.get_table = function (table_name) {
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@ $(function () {
 | 
			
		||||
    $("#stream-filters-container").perfectScrollbar({
 | 
			
		||||
        suppressScrollX: true,
 | 
			
		||||
        useKeyboard: false,
 | 
			
		||||
        wheelSpeed: 20
 | 
			
		||||
        wheelSpeed: 20,
 | 
			
		||||
    });
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -66,7 +66,7 @@ exports.initialize = function () {
 | 
			
		||||
        updater: narrow_or_search_for_term,
 | 
			
		||||
        sorter: function (items) {
 | 
			
		||||
            return items;
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    $("#searchbox_form").keydown(function (e) {
 | 
			
		||||
 
 | 
			
		||||
@@ -66,7 +66,7 @@ function get_stream_suggestions(operators) {
 | 
			
		||||
        var description = prefix + ' ' + highlighted_stream;
 | 
			
		||||
        var term = {
 | 
			
		||||
            operator: 'stream',
 | 
			
		||||
            operand: stream
 | 
			
		||||
            operand: stream,
 | 
			
		||||
        };
 | 
			
		||||
        var search_string = Filter.unparse([term]);
 | 
			
		||||
        return {description: description, search_string: search_string};
 | 
			
		||||
@@ -142,7 +142,7 @@ function get_private_suggestions(all_people, operators, person_operator_matches)
 | 
			
		||||
        var term = {
 | 
			
		||||
            operator: matching_operator,
 | 
			
		||||
            operand: person.email,
 | 
			
		||||
            negated: negated
 | 
			
		||||
            negated: negated,
 | 
			
		||||
        };
 | 
			
		||||
        var name = highlight_person(query, person);
 | 
			
		||||
        var description = prefix + ' ' + name;
 | 
			
		||||
@@ -156,7 +156,7 @@ function get_private_suggestions(all_people, operators, person_operator_matches)
 | 
			
		||||
 | 
			
		||||
    suggestions.push({
 | 
			
		||||
        search_string: 'is:private',
 | 
			
		||||
        description: 'Private messages'
 | 
			
		||||
        description: 'Private messages',
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    return suggestions;
 | 
			
		||||
@@ -324,32 +324,32 @@ function get_special_filter_suggestions(query, operators) {
 | 
			
		||||
    var suggestions = [
 | 
			
		||||
        {
 | 
			
		||||
            search_string: '',
 | 
			
		||||
            description: 'Home'
 | 
			
		||||
            description: 'Home',
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            search_string: 'in:all',
 | 
			
		||||
            description: 'All messages'
 | 
			
		||||
            description: 'All messages',
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            search_string: 'is:private',
 | 
			
		||||
            description: 'Private messages'
 | 
			
		||||
            description: 'Private messages',
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            search_string: 'is:starred',
 | 
			
		||||
            description: 'Starred messages'
 | 
			
		||||
            description: 'Starred messages',
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            search_string: 'is:mentioned',
 | 
			
		||||
            description: '@-mentions'
 | 
			
		||||
            description: '@-mentions',
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            search_string: 'is:alerted',
 | 
			
		||||
            description: 'Alerted messages'
 | 
			
		||||
            description: 'Alerted messages',
 | 
			
		||||
        },
 | 
			
		||||
        {
 | 
			
		||||
            search_string: 'sender:' + page_params.email,
 | 
			
		||||
            description: 'Sent by me'
 | 
			
		||||
        }
 | 
			
		||||
            description: 'Sent by me',
 | 
			
		||||
        },
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    query = query.toLowerCase();
 | 
			
		||||
@@ -421,7 +421,7 @@ exports.get_suggestions = function (query) {
 | 
			
		||||
    });
 | 
			
		||||
    return {
 | 
			
		||||
        strings: strings,
 | 
			
		||||
        lookup_table: lookup_table
 | 
			
		||||
        lookup_table: lookup_table,
 | 
			
		||||
    };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -37,7 +37,7 @@ function dispatch_normal_event(event) {
 | 
			
		||||
        var reload_options = {save_pointer: true,
 | 
			
		||||
                              save_narrow: true,
 | 
			
		||||
                              save_compose: true,
 | 
			
		||||
                              message: "The application has been updated; reloading!"
 | 
			
		||||
                              message: "The application has been updated; reloading!",
 | 
			
		||||
                             };
 | 
			
		||||
        if (event.immediate) {
 | 
			
		||||
            reload_options.immediate = true;
 | 
			
		||||
@@ -422,7 +422,7 @@ function get_events(options) {
 | 
			
		||||
            }
 | 
			
		||||
            var retry_sec = Math.min(90, Math.exp(get_events_failures/2));
 | 
			
		||||
            get_events_timeout = setTimeout(get_events, retry_sec*1000);
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -480,7 +480,7 @@ exports.cleanup_event_queue = function cleanup_event_queue() {
 | 
			
		||||
    page_params.event_queue_expired = true;
 | 
			
		||||
    channel.del({
 | 
			
		||||
        url:      '/json/events',
 | 
			
		||||
        data:     {queue_id: page_params.event_queue_id}
 | 
			
		||||
        data:     {queue_id: page_params.event_queue_id},
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -120,7 +120,7 @@ function render_bots() {
 | 
			
		||||
            zuliprc: 'zuliprc', // Most browsers do not allow filename starting with `.`
 | 
			
		||||
            default_sending_stream: elem.default_sending_stream,
 | 
			
		||||
            default_events_register_stream: elem.default_events_register_stream,
 | 
			
		||||
            default_all_public_streams: elem.default_all_public_streams
 | 
			
		||||
            default_all_public_streams: elem.default_all_public_streams,
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
@@ -160,7 +160,7 @@ function _setup_page() {
 | 
			
		||||
                    $('#create_bot_default_events_register_stream'),
 | 
			
		||||
                    [['__all_public__', 'All public streams']]
 | 
			
		||||
                );
 | 
			
		||||
            }
 | 
			
		||||
            },
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -270,7 +270,7 @@ function _setup_page() {
 | 
			
		||||
            // Whether successful or not, clear the password boxes.
 | 
			
		||||
            // TODO: Clear these earlier, while the request is still pending.
 | 
			
		||||
            clear_password_change();
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    function update_notification_settings_success(resp, statusText, xhr) {
 | 
			
		||||
@@ -333,7 +333,7 @@ function _setup_page() {
 | 
			
		||||
            url: "/json/settings/notifications",
 | 
			
		||||
            data: notification_changes,
 | 
			
		||||
            success: success_func,
 | 
			
		||||
            error: error_func
 | 
			
		||||
            error: error_func,
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -361,7 +361,7 @@ function _setup_page() {
 | 
			
		||||
            url: "/json/settings/notifications",
 | 
			
		||||
            data: data,
 | 
			
		||||
            success: update_notification_settings_success,
 | 
			
		||||
            error: update_notification_settings_error
 | 
			
		||||
            error: update_notification_settings_error,
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -422,7 +422,7 @@ function _setup_page() {
 | 
			
		||||
            },
 | 
			
		||||
            error: function (xhr) {
 | 
			
		||||
                ui.report_error(i18n.t("Error updating user list placement setting"), xhr, $('#display-settings-status').expectOne());
 | 
			
		||||
            }
 | 
			
		||||
            },
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
@@ -446,7 +446,7 @@ function _setup_page() {
 | 
			
		||||
            },
 | 
			
		||||
            error: function (xhr) {
 | 
			
		||||
                ui.report_error(i18n.t("Error updating time format setting"), xhr, $('#display-settings-status').expectOne());
 | 
			
		||||
            }
 | 
			
		||||
            },
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
@@ -475,7 +475,7 @@ function _setup_page() {
 | 
			
		||||
            },
 | 
			
		||||
            error: function (xhr) {
 | 
			
		||||
                ui.report_error(i18n.t("Error updating default language setting"), xhr, $('#display-settings-status').expectOne());
 | 
			
		||||
            }
 | 
			
		||||
            },
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
@@ -500,7 +500,7 @@ function _setup_page() {
 | 
			
		||||
            },
 | 
			
		||||
            error: function (xhr) {
 | 
			
		||||
                ui.report_error(i18n.t("Error deactivating account"), xhr, $('#settings-status').expectOne());
 | 
			
		||||
            }
 | 
			
		||||
            },
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
@@ -522,7 +522,7 @@ function _setup_page() {
 | 
			
		||||
            ui.report_error(i18n.t("Error getting API key"), xhr, $('#settings-status').expectOne());
 | 
			
		||||
            $("#show_api_key_box").hide();
 | 
			
		||||
            $("#get_api_key_box").show();
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    function upload_avatar(file_input) {
 | 
			
		||||
@@ -548,7 +548,7 @@ function _setup_page() {
 | 
			
		||||
                $("#user-settings-avatar").expectOne().attr("src", url);
 | 
			
		||||
                $("#user_avatar_delete_button").show();
 | 
			
		||||
                exports.avatar_stamp += 1;
 | 
			
		||||
            }
 | 
			
		||||
            },
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
@@ -612,9 +612,9 @@ function _setup_page() {
 | 
			
		||||
                },
 | 
			
		||||
                complete: function () {
 | 
			
		||||
                    $('#create_bot_button').val('Create bot').prop('disabled', false);
 | 
			
		||||
                }
 | 
			
		||||
                },
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    $("#bots_list").on("click", "button.delete_bot", function (e) {
 | 
			
		||||
@@ -627,7 +627,7 @@ function _setup_page() {
 | 
			
		||||
            },
 | 
			
		||||
            error: function (xhr) {
 | 
			
		||||
                $('#bot_delete_error').text(JSON.parse(xhr.responseText).msg).show();
 | 
			
		||||
            }
 | 
			
		||||
            },
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
@@ -644,7 +644,7 @@ function _setup_page() {
 | 
			
		||||
            error: function (xhr) {
 | 
			
		||||
                var row = $(e.currentTarget).closest("li");
 | 
			
		||||
                row.find(".api_key_error").text(JSON.parse(xhr.responseText).msg).show();
 | 
			
		||||
            }
 | 
			
		||||
            },
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
@@ -729,9 +729,9 @@ function _setup_page() {
 | 
			
		||||
                        loading.destroy_indicator(spinner);
 | 
			
		||||
                        edit_button.show();
 | 
			
		||||
                        errors.text(JSON.parse(xhr.responseText).msg).show();
 | 
			
		||||
                    }
 | 
			
		||||
                    },
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
            },
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -763,7 +763,7 @@ function _setup_page() {
 | 
			
		||||
            },
 | 
			
		||||
            error: function (xhr) {
 | 
			
		||||
                $('#user_api_key_error').text(JSON.parse(xhr.responseText).msg).show();
 | 
			
		||||
            }
 | 
			
		||||
            },
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
@@ -792,7 +792,7 @@ function _setup_page() {
 | 
			
		||||
            },
 | 
			
		||||
            error: function (xhr) {
 | 
			
		||||
                ui.report_error(i18n.t("Error changing settings"), xhr, $('#ui-settings-status').expectOne());
 | 
			
		||||
            }
 | 
			
		||||
            },
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -19,7 +19,7 @@ $(function () {
 | 
			
		||||
                // Only send the token to relative URLs i.e. locally.
 | 
			
		||||
                xhr.setRequestHeader("X-CSRFToken", csrf_token);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    // For some reason, jQuery wants this to be attached to an element.
 | 
			
		||||
 
 | 
			
		||||
@@ -6,7 +6,7 @@ var CLOSE_REASONS = {
 | 
			
		||||
    auth_fail:    {code: 4002, msg: "Authentication failed"},
 | 
			
		||||
    ack_timeout:  {code: 4003, msg: "ACK timeout"},
 | 
			
		||||
    cant_send:    {code: 4004, msg: "User attempted to send while Socket was not ready"},
 | 
			
		||||
    unsuspend:    {code: 4005, msg: "Got unsuspend event"}
 | 
			
		||||
    unsuspend:    {code: 4005, msg: "Got unsuspend event"},
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
function Socket(url) {
 | 
			
		||||
@@ -404,7 +404,7 @@ Socket.prototype = {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        this._save_localstorage_requests();
 | 
			
		||||
    }
 | 
			
		||||
    },
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
return Socket;
 | 
			
		||||
 
 | 
			
		||||
@@ -7,19 +7,19 @@
 | 
			
		||||
    var Cache = require('i18next-localstorage-cache');
 | 
			
		||||
 | 
			
		||||
    var backendOptions = {
 | 
			
		||||
        loadPath: '/static/locale/__lng__/translations.json'
 | 
			
		||||
        loadPath: '/static/locale/__lng__/translations.json',
 | 
			
		||||
    };
 | 
			
		||||
    var callbacks = [];
 | 
			
		||||
    var initialized = false;
 | 
			
		||||
 | 
			
		||||
    var detectionOptions = {
 | 
			
		||||
        order: ['htmlTag'],
 | 
			
		||||
        htmlTag: document.documentElement
 | 
			
		||||
        htmlTag: document.documentElement,
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    var cacheOptions = {
 | 
			
		||||
        enabled: true,
 | 
			
		||||
        prefix: page_params.server_generation + ':'
 | 
			
		||||
        prefix: page_params.server_generation + ':',
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    i18n.use(XHR)
 | 
			
		||||
@@ -30,12 +30,12 @@
 | 
			
		||||
            keySeparator: false,
 | 
			
		||||
            interpolation: {
 | 
			
		||||
                prefix: "__",
 | 
			
		||||
                suffix: "__"
 | 
			
		||||
                suffix: "__",
 | 
			
		||||
            },
 | 
			
		||||
            backend: backendOptions,
 | 
			
		||||
            detection: detectionOptions,
 | 
			
		||||
            cache: cacheOptions,
 | 
			
		||||
            fallbackLng: 'en'
 | 
			
		||||
            fallbackLng: 'en',
 | 
			
		||||
        }, function () {
 | 
			
		||||
            var i;
 | 
			
		||||
            initialized = true;
 | 
			
		||||
 
 | 
			
		||||
@@ -73,14 +73,14 @@ var stream_color_palette = [
 | 
			
		||||
    ['a47462', 'c2726a', 'e4523d', 'e7664d', 'ee7e4a', 'f4ae55'],
 | 
			
		||||
    ['76ce90', '53a063', '94c849', 'bfd56f', 'fae589', 'f5ce6e'],
 | 
			
		||||
    ['a6dcbf', 'addfe5', 'a6c7e5', '4f8de4', '95a5fd', 'b0a5fd'],
 | 
			
		||||
    ['c2c2c2', 'c8bebf', 'c6a8ad', 'e79ab5', 'bd86e5', '9987e1']
 | 
			
		||||
    ['c2c2c2', 'c8bebf', 'c6a8ad', 'e79ab5', 'bd86e5', '9987e1'],
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
var subscriptions_table_colorpicker_options = {
 | 
			
		||||
    clickoutFiresChange: true,
 | 
			
		||||
    showPalette: true,
 | 
			
		||||
    showInput: true,
 | 
			
		||||
    palette: stream_color_palette
 | 
			
		||||
    palette: stream_color_palette,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports.set_colorpicker_color = function (colorpicker, color) {
 | 
			
		||||
@@ -119,7 +119,7 @@ exports.sidebar_popover_colorpicker_options = {
 | 
			
		||||
    showInput: true,
 | 
			
		||||
    flat: true,
 | 
			
		||||
    palette: stream_color_palette,
 | 
			
		||||
    change: picker_do_change_color
 | 
			
		||||
    change: picker_do_change_color,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports.sidebar_popover_colorpicker_options_full = {
 | 
			
		||||
@@ -130,7 +130,7 @@ exports.sidebar_popover_colorpicker_options_full = {
 | 
			
		||||
    cancelText: "",
 | 
			
		||||
    chooseText: "choose",
 | 
			
		||||
    palette: stream_color_palette,
 | 
			
		||||
    change: picker_do_change_color
 | 
			
		||||
    change: picker_do_change_color,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
var lightness_threshold;
 | 
			
		||||
 
 | 
			
		||||
@@ -204,7 +204,7 @@ exports.create_streams = function (streams) {
 | 
			
		||||
        // We handle subscriber stuff in other events.
 | 
			
		||||
        var attrs = _.defaults(stream, {
 | 
			
		||||
            subscribers: [],
 | 
			
		||||
            subscribed: false
 | 
			
		||||
            subscribed: false,
 | 
			
		||||
        });
 | 
			
		||||
        exports.create_sub_from_server_data(stream.name, attrs);
 | 
			
		||||
    });
 | 
			
		||||
@@ -237,7 +237,7 @@ exports.create_sub_from_server_data = function (stream_name, attrs) {
 | 
			
		||||
        invite_only: false,
 | 
			
		||||
        desktop_notifications: page_params.stream_desktop_notifications_enabled,
 | 
			
		||||
        audible_notifications: page_params.stream_sounds_enabled,
 | 
			
		||||
        description: ''
 | 
			
		||||
        description: '',
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    exports.set_subscribers(sub, subscriber_user_ids);
 | 
			
		||||
@@ -272,7 +272,7 @@ exports.add_admin_options = function (sub) {
 | 
			
		||||
    return _.extend(sub, {
 | 
			
		||||
        is_admin: page_params.is_admin,
 | 
			
		||||
        can_make_public: page_params.is_admin && sub.invite_only && sub.subscribed,
 | 
			
		||||
        can_make_private: page_params.is_admin && !sub.invite_only
 | 
			
		||||
        can_make_private: page_params.is_admin && !sub.invite_only,
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -224,7 +224,7 @@ function build_stream_sidebar_li(sub) {
 | 
			
		||||
                not_in_home_view: (stream_data.in_home_view(name) === false),
 | 
			
		||||
                invite_only: sub.invite_only,
 | 
			
		||||
                color: stream_data.get_color(name),
 | 
			
		||||
                pin_to_top: sub.pin_to_top
 | 
			
		||||
                pin_to_top: sub.pin_to_top,
 | 
			
		||||
               };
 | 
			
		||||
    args.dark_background = stream_color.get_color_class(args.color);
 | 
			
		||||
    var list_item = $(templates.render('stream_sidebar_row', args));
 | 
			
		||||
@@ -274,7 +274,7 @@ exports.redraw_stream_privacy = function (stream_name) {
 | 
			
		||||
 | 
			
		||||
    var args = {
 | 
			
		||||
        invite_only: sub.invite_only,
 | 
			
		||||
        dark_background: dark_background
 | 
			
		||||
        dark_background: dark_background,
 | 
			
		||||
    };
 | 
			
		||||
 | 
			
		||||
    if (sub.invite_only) {
 | 
			
		||||
@@ -387,7 +387,7 @@ $(function () {
 | 
			
		||||
    // each stream.
 | 
			
		||||
    topic_list.set_click_handlers({
 | 
			
		||||
        zoom_in: zoom_in,
 | 
			
		||||
        zoom_out: zoom_out
 | 
			
		||||
        zoom_out: zoom_out,
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    pm_list.set_click_handlers();
 | 
			
		||||
 
 | 
			
		||||
@@ -2,7 +2,7 @@ var subs = (function () {
 | 
			
		||||
 | 
			
		||||
var meta = {
 | 
			
		||||
    callbacks: {},
 | 
			
		||||
    stream_created: false
 | 
			
		||||
    stream_created: false,
 | 
			
		||||
};
 | 
			
		||||
var exports = {};
 | 
			
		||||
 | 
			
		||||
@@ -48,7 +48,7 @@ function set_stream_property(stream_name, property, value) {
 | 
			
		||||
    return channel.post({
 | 
			
		||||
        url:      '/json/subscriptions/property',
 | 
			
		||||
        data: {subscription_data: JSON.stringify([sub_data])},
 | 
			
		||||
        timeout:  10*1000
 | 
			
		||||
        timeout:  10*1000,
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -335,7 +335,7 @@ function show_subscription_settings(sub_row) {
 | 
			
		||||
        error: function () {
 | 
			
		||||
            loading.destroy_indicator(indicator_elem);
 | 
			
		||||
            error_elem.removeClass("hide").text("Could not fetch subscriber list");
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    sub_settings.find('input[name="principal"]').typeahead({
 | 
			
		||||
@@ -357,7 +357,7 @@ function show_subscription_settings(sub_row) {
 | 
			
		||||
        sorter: typeahead_helper.sort_recipientbox_typeahead,
 | 
			
		||||
        updater: function (item) {
 | 
			
		||||
            return item.email;
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    var colorpicker = sub_settings.find('.colorpicker');
 | 
			
		||||
@@ -549,7 +549,7 @@ exports.setup_page = function (callback) {
 | 
			
		||||
            callback: function () {
 | 
			
		||||
                actually_filter_streams();
 | 
			
		||||
                remove_temporarily_miscategorized_streams();
 | 
			
		||||
            }
 | 
			
		||||
            },
 | 
			
		||||
        }).get();
 | 
			
		||||
 | 
			
		||||
        if (should_list_all_streams()) {
 | 
			
		||||
@@ -568,7 +568,7 @@ exports.setup_page = function (callback) {
 | 
			
		||||
        var template_data = {
 | 
			
		||||
            can_create_streams: page_params.can_create_streams,
 | 
			
		||||
            subscriptions: sub_rows,
 | 
			
		||||
            hide_all_streams: !should_list_all_streams()
 | 
			
		||||
            hide_all_streams: !should_list_all_streams(),
 | 
			
		||||
        };
 | 
			
		||||
        var rendered = templates.render('subscription_table_body', template_data);
 | 
			
		||||
        $('#subscriptions_table').append(rendered);
 | 
			
		||||
@@ -611,7 +611,7 @@ exports.setup_page = function (callback) {
 | 
			
		||||
exports.onlaunch = function (name, callback, keep) {
 | 
			
		||||
    meta.callbacks[name] = {
 | 
			
		||||
        func: callback,
 | 
			
		||||
        keep: keep
 | 
			
		||||
        keep: keep,
 | 
			
		||||
    };
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@@ -699,7 +699,7 @@ function ajaxSubscribe(stream) {
 | 
			
		||||
        error: function (xhr) {
 | 
			
		||||
            ui.report_error(i18n.t("Error adding subscription"), xhr,
 | 
			
		||||
                            $("#subscriptions-status"), 'subscriptions-status');
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -714,7 +714,7 @@ function ajaxUnsubscribe(stream) {
 | 
			
		||||
        error: function (xhr) {
 | 
			
		||||
            ui.report_error(i18n.t("Error removing subscription"), xhr,
 | 
			
		||||
                            $("#subscriptions-status"), 'subscriptions-status');
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -725,7 +725,7 @@ function ajaxSubscribeForCreation(stream, description, principals, invite_only,
 | 
			
		||||
        data: {subscriptions: JSON.stringify([{name: stream, description: description}]),
 | 
			
		||||
               principals: JSON.stringify(principals),
 | 
			
		||||
               invite_only: JSON.stringify(invite_only),
 | 
			
		||||
               announce: JSON.stringify(announce)
 | 
			
		||||
               announce: JSON.stringify(announce),
 | 
			
		||||
        },
 | 
			
		||||
        success: function () {
 | 
			
		||||
            $("#create_stream_name").val("");
 | 
			
		||||
@@ -736,7 +736,7 @@ function ajaxSubscribeForCreation(stream, description, principals, invite_only,
 | 
			
		||||
        error: function (xhr) {
 | 
			
		||||
            ui.report_error(i18n.t("Error creating stream"), xhr,
 | 
			
		||||
                            $("#subscriptions-status"), 'subscriptions-status');
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -764,7 +764,7 @@ function show_new_stream_modal() {
 | 
			
		||||
    $(".right .settings").hide();
 | 
			
		||||
    $('#people_to_add').html(templates.render('new_stream_users', {
 | 
			
		||||
        users: people.get_rest_of_realm(),
 | 
			
		||||
        streams: stream_data.get_streams_for_settings_page()
 | 
			
		||||
        streams: stream_data.get_streams_for_settings_page(),
 | 
			
		||||
    }));
 | 
			
		||||
 | 
			
		||||
    // Make the options default to the same each time:
 | 
			
		||||
@@ -782,7 +782,7 @@ exports.invite_user_to_stream = function (user_email, stream_name, success, fail
 | 
			
		||||
        data: {subscriptions: JSON.stringify([{name: stream_name}]),
 | 
			
		||||
               principals: JSON.stringify([user_email])},
 | 
			
		||||
        success: success,
 | 
			
		||||
        error: failure
 | 
			
		||||
        error: failure,
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@@ -792,7 +792,7 @@ exports.remove_user_from_stream = function (user_email, stream_name, success, fa
 | 
			
		||||
        data: {subscriptions: JSON.stringify([stream_name]),
 | 
			
		||||
               principals: JSON.stringify([user_email])},
 | 
			
		||||
        success: success,
 | 
			
		||||
        error: failure
 | 
			
		||||
        error: failure,
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@@ -1214,7 +1214,7 @@ $(function () {
 | 
			
		||||
            error: function (xhr) {
 | 
			
		||||
                ui.report_error(i18n.t("Error renaming stream"), xhr,
 | 
			
		||||
                                $("#subscriptions-status"), 'subscriptions-status');
 | 
			
		||||
            }
 | 
			
		||||
            },
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
@@ -1230,7 +1230,7 @@ $(function () {
 | 
			
		||||
            // Stream names might contain unsafe characters so we must encode it first.
 | 
			
		||||
            url: '/json/streams/' + encodeURIComponent(stream_name),
 | 
			
		||||
            data: {
 | 
			
		||||
                description: JSON.stringify(description)
 | 
			
		||||
                description: JSON.stringify(description),
 | 
			
		||||
            },
 | 
			
		||||
            success: function () {
 | 
			
		||||
                // The event from the server will update the rest of the UI
 | 
			
		||||
@@ -1240,7 +1240,7 @@ $(function () {
 | 
			
		||||
            error: function (xhr) {
 | 
			
		||||
                ui.report_error(i18n.t("Error updating the stream description"), xhr,
 | 
			
		||||
                                $("#subscriptions-status"), 'subscriptions-status');
 | 
			
		||||
            }
 | 
			
		||||
            },
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
@@ -1297,7 +1297,7 @@ $(function () {
 | 
			
		||||
                var stream_settings = settings_for_sub(sub);
 | 
			
		||||
                var feedback_div = stream_settings.find(".change-stream-privacy-feedback").expectOne();
 | 
			
		||||
                ui.report_error(error_message, xhr, feedback_div);
 | 
			
		||||
            }
 | 
			
		||||
            },
 | 
			
		||||
        });
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -84,7 +84,7 @@ exports.build_widget = function (parent_elem, stream, active_topic, max_topics)
 | 
			
		||||
                unread: num_unread,
 | 
			
		||||
                is_zero: num_unread === 0,
 | 
			
		||||
                is_muted: muting.is_topic_muted(stream, topic_name),
 | 
			
		||||
                url: narrow.by_stream_subject_uri(stream, topic_name)
 | 
			
		||||
                url: narrow.by_stream_subject_uri(stream, topic_name),
 | 
			
		||||
            };
 | 
			
		||||
            var li = $(templates.render('topic_list_item', topic_info));
 | 
			
		||||
            self.topic_items.set(topic_name, li);
 | 
			
		||||
 
 | 
			
		||||
@@ -29,7 +29,7 @@ var fake_messages = [
 | 
			
		||||
        subject: "screenshots",
 | 
			
		||||
        timestr: "12:11",
 | 
			
		||||
        timestamp: today,
 | 
			
		||||
        type: "stream"
 | 
			
		||||
        type: "stream",
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
        id: 2,
 | 
			
		||||
@@ -43,7 +43,7 @@ var fake_messages = [
 | 
			
		||||
        subject: "screenshots",
 | 
			
		||||
        timestr: "12:11",
 | 
			
		||||
        timestamp: today,
 | 
			
		||||
        type: "stream"
 | 
			
		||||
        type: "stream",
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
        id: 3,
 | 
			
		||||
@@ -57,7 +57,7 @@ var fake_messages = [
 | 
			
		||||
        subject: "screenshots",
 | 
			
		||||
        timestr: "12:16",
 | 
			
		||||
        timestamp: today,
 | 
			
		||||
        type: "stream"
 | 
			
		||||
        type: "stream",
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
        id: 4,
 | 
			
		||||
@@ -71,7 +71,7 @@ var fake_messages = [
 | 
			
		||||
        subject: "integrations",
 | 
			
		||||
        timestr: "12:25",
 | 
			
		||||
        timestamp: today,
 | 
			
		||||
        type: "stream"
 | 
			
		||||
        type: "stream",
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
        id: 5,
 | 
			
		||||
@@ -85,7 +85,7 @@ var fake_messages = [
 | 
			
		||||
        subject: "integrations",
 | 
			
		||||
        timestr: "12:25",
 | 
			
		||||
        timestamp: today,
 | 
			
		||||
        type: "stream"
 | 
			
		||||
        type: "stream",
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
        id: 6,
 | 
			
		||||
@@ -99,7 +99,7 @@ var fake_messages = [
 | 
			
		||||
        subject: "integrations",
 | 
			
		||||
        timestr: "12:26",
 | 
			
		||||
        timestamp: today,
 | 
			
		||||
        type: "stream"
 | 
			
		||||
        type: "stream",
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
        id: 7,
 | 
			
		||||
@@ -113,7 +113,7 @@ var fake_messages = [
 | 
			
		||||
        subject: "integrations",
 | 
			
		||||
        timestr: "12:26",
 | 
			
		||||
        timestamp: today,
 | 
			
		||||
        type: "stream"
 | 
			
		||||
        type: "stream",
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
        id: 8,
 | 
			
		||||
@@ -127,7 +127,7 @@ var fake_messages = [
 | 
			
		||||
        subject: "weekly meeting",
 | 
			
		||||
        timestr: "12:30",
 | 
			
		||||
        timestamp: today,
 | 
			
		||||
        type: "stream"
 | 
			
		||||
        type: "stream",
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
        id: 9,
 | 
			
		||||
@@ -141,7 +141,7 @@ var fake_messages = [
 | 
			
		||||
        subject: "screenshots",
 | 
			
		||||
        timestr: "12:32",
 | 
			
		||||
        timestamp: today,
 | 
			
		||||
        type: "stream"
 | 
			
		||||
        type: "stream",
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
        id: 10,
 | 
			
		||||
@@ -155,7 +155,7 @@ var fake_messages = [
 | 
			
		||||
        subject: "screenshots",
 | 
			
		||||
        timestr: "12:32",
 | 
			
		||||
        timestamp: today,
 | 
			
		||||
        type: "stream"
 | 
			
		||||
        type: "stream",
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
        id: 11,
 | 
			
		||||
@@ -169,7 +169,7 @@ var fake_messages = [
 | 
			
		||||
        subject: "screenshots",
 | 
			
		||||
        timestr: "12:16",
 | 
			
		||||
        timestamp: today,
 | 
			
		||||
        type: "stream"
 | 
			
		||||
        type: "stream",
 | 
			
		||||
    },
 | 
			
		||||
    {
 | 
			
		||||
        id: 12,
 | 
			
		||||
@@ -183,8 +183,8 @@ var fake_messages = [
 | 
			
		||||
        subject: "screenshots",
 | 
			
		||||
        timestr: "12:32",
 | 
			
		||||
        timestamp: today,
 | 
			
		||||
        type: "stream"
 | 
			
		||||
    }
 | 
			
		||||
        type: "stream",
 | 
			
		||||
    },
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
function send_delayed_stream_message(stream, topic, content, delay) {
 | 
			
		||||
@@ -197,7 +197,7 @@ function send_delayed_stream_message(stream, topic, content, delay) {
 | 
			
		||||
            dataType: 'json',
 | 
			
		||||
            url: '/json/tutorial_send_message',
 | 
			
		||||
            type: 'POST',
 | 
			
		||||
            data: data
 | 
			
		||||
            data: data,
 | 
			
		||||
        });
 | 
			
		||||
    }, delay * 1000); // delay is in seconds.
 | 
			
		||||
}
 | 
			
		||||
@@ -225,7 +225,7 @@ function set_tutorial_status(status, callback) {
 | 
			
		||||
    return channel.post({
 | 
			
		||||
        url:      '/json/tutorial_status',
 | 
			
		||||
        data:     {status: JSON.stringify(status)},
 | 
			
		||||
        success:  callback
 | 
			
		||||
        success:  callback,
 | 
			
		||||
    });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -295,7 +295,7 @@ function create_and_show_popover(target_div, placement, title, content_template)
 | 
			
		||||
                                                   placement: placement}),
 | 
			
		||||
        content: templates.render(content_template, {placement: placement,
 | 
			
		||||
                                                     page_params: page_params}),
 | 
			
		||||
        trigger: "manual"
 | 
			
		||||
        trigger: "manual",
 | 
			
		||||
    });
 | 
			
		||||
    target_div.popover("show");
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -512,7 +512,7 @@ $(function () {
 | 
			
		||||
                        _.pluck(event.msg_list._items, 'id'),
 | 
			
		||||
                        _.chain(current_msg_list._items).pluck('id').clone().value().sort()
 | 
			
		||||
                    ),
 | 
			
		||||
                    found_in_dom: row_from_dom.length
 | 
			
		||||
                    found_in_dom: row_from_dom.length,
 | 
			
		||||
                });
 | 
			
		||||
            }
 | 
			
		||||
            if (event.target_scroll_offset !== undefined) {
 | 
			
		||||
 
 | 
			
		||||
@@ -353,7 +353,7 @@ exports.mark_stream_as_read = function mark_stream_as_read(stream, cont) {
 | 
			
		||||
                   all:      false,
 | 
			
		||||
                   op:       'add',
 | 
			
		||||
                   flag:     'read',
 | 
			
		||||
                   stream_name: stream
 | 
			
		||||
                   stream_name: stream,
 | 
			
		||||
                  },
 | 
			
		||||
        success:  cont});
 | 
			
		||||
};
 | 
			
		||||
@@ -367,7 +367,7 @@ exports.mark_topic_as_read = function mark_topic_as_read(stream, topic, cont) {
 | 
			
		||||
               op:       'add',
 | 
			
		||||
               flag:     'read',
 | 
			
		||||
               topic_name: topic,
 | 
			
		||||
               stream_name: stream
 | 
			
		||||
               stream_name: stream,
 | 
			
		||||
               },
 | 
			
		||||
    success:  cont});
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
@@ -214,7 +214,7 @@ exports.CachedValue.prototype = {
 | 
			
		||||
 | 
			
		||||
    reset: function CachedValue_reset() {
 | 
			
		||||
        this._value = unassigned_value_sentinel;
 | 
			
		||||
    }
 | 
			
		||||
    },
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports.execute_early = function (func) {
 | 
			
		||||
 
 | 
			
		||||
@@ -133,13 +133,13 @@ function add_to_visible(candidates, visible,
 | 
			
		||||
var top_of_feed = new util.CachedValue({
 | 
			
		||||
    compute_value: function () {
 | 
			
		||||
        return $(".floating_recipient").offset().top + $(".floating_recipient").outerHeight();
 | 
			
		||||
    }
 | 
			
		||||
    },
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
var bottom_of_feed = new util.CachedValue({
 | 
			
		||||
    compute_value: function () {
 | 
			
		||||
        return $("#compose")[0].getBoundingClientRect().top;
 | 
			
		||||
    }
 | 
			
		||||
    },
 | 
			
		||||
});
 | 
			
		||||
 | 
			
		||||
function _visible_divs(selected_row, row_min_height, row_to_output, div_class,
 | 
			
		||||
@@ -232,7 +232,7 @@ function make_dimen_wrapper(dimen_name, dimen_func) {
 | 
			
		||||
    dimensions[dimen_name] = new util.CachedValue({
 | 
			
		||||
        compute_value: function () {
 | 
			
		||||
            return dimen_func.call(exports.message_pane);
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
    });
 | 
			
		||||
    return function viewport_dimension_wrapper() {
 | 
			
		||||
        if (arguments.length !== 0) {
 | 
			
		||||
@@ -268,7 +268,7 @@ exports.system_initiated_animate_scroll = function (scroll_amount) {
 | 
			
		||||
        scrollTop: viewport_offset + scroll_amount,
 | 
			
		||||
        always: function () {
 | 
			
		||||
            in_stoppable_autoscroll = false;
 | 
			
		||||
        }
 | 
			
		||||
        },
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@@ -279,7 +279,7 @@ exports.user_initiated_animate_scroll = function (scroll_amount) {
 | 
			
		||||
    var viewport_offset = exports.scrollTop();
 | 
			
		||||
 | 
			
		||||
    exports.message_pane.animate({
 | 
			
		||||
        scrollTop: viewport_offset + scroll_amount
 | 
			
		||||
        scrollTop: viewport_offset + scroll_amount,
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user