mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	js: Fix a bunch of indentation issues found by eslint.
This is preparation for enabling an eslint indentation configuration. 90% of these changes are just fixes for indentation errors that have snuck into the codebase over the years; the others are more significant reformatting to make eslint happy (that are not otherwise actually improvements). The one area that we do not attempt to work on here is the "switch/case" indentation.
This commit is contained in:
		@@ -352,9 +352,9 @@ exports.initialize = function () {
 | 
			
		||||
 | 
			
		||||
    $(window).focus(focus_gained);
 | 
			
		||||
    $(window).idle({idle: DEFAULT_IDLE_TIMEOUT_MS,
 | 
			
		||||
                onIdle: focus_lost,
 | 
			
		||||
                onActive: focus_gained,
 | 
			
		||||
                keepTracking: true});
 | 
			
		||||
                    onIdle: focus_lost,
 | 
			
		||||
                    onActive: focus_gained,
 | 
			
		||||
                    keepTracking: true});
 | 
			
		||||
 | 
			
		||||
    presence.set_info(page_params.presences,
 | 
			
		||||
                      page_params.initial_servertime);
 | 
			
		||||
 
 | 
			
		||||
@@ -43,7 +43,7 @@ function add_alert_word(alert_word) {
 | 
			
		||||
 | 
			
		||||
    var words_to_be_added = [alert_word];
 | 
			
		||||
 | 
			
		||||
     channel.post({
 | 
			
		||||
    channel.post({
 | 
			
		||||
        url: '/json/users/me/alert_words',
 | 
			
		||||
        data: {alert_words: JSON.stringify(words_to_be_added)},
 | 
			
		||||
        success: function () {
 | 
			
		||||
 
 | 
			
		||||
@@ -62,22 +62,22 @@ exports.build_user_avatar_widget = function (upload_function) {
 | 
			
		||||
        channel.del({
 | 
			
		||||
            url: '/json/users/me/avatar',
 | 
			
		||||
            success: function (data) {
 | 
			
		||||
              $("#user-settings-avatar").expectOne().attr("src", data.avatar_url);
 | 
			
		||||
              $("#user_avatar_delete_button").hide();
 | 
			
		||||
              $("#user-avatar-source").show();
 | 
			
		||||
              // Need to clear input because of a small edge case
 | 
			
		||||
              // where you try to upload the same image you just deleted.
 | 
			
		||||
              get_file_input().val('');
 | 
			
		||||
                $("#user-settings-avatar").expectOne().attr("src", data.avatar_url);
 | 
			
		||||
                $("#user_avatar_delete_button").hide();
 | 
			
		||||
                $("#user-avatar-source").show();
 | 
			
		||||
                // Need to clear input because of a small edge case
 | 
			
		||||
                // where you try to upload the same image you just deleted.
 | 
			
		||||
                get_file_input().val('');
 | 
			
		||||
            },
 | 
			
		||||
        });
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    return upload_widget.build_direct_upload_widget(
 | 
			
		||||
            get_file_input,
 | 
			
		||||
            $("#user_avatar_file_input_error").expectOne(),
 | 
			
		||||
            $("#user_avatar_upload_button").expectOne(),
 | 
			
		||||
            upload_function,
 | 
			
		||||
            page_params.max_avatar_file_size
 | 
			
		||||
        get_file_input,
 | 
			
		||||
        $("#user_avatar_file_input_error").expectOne(),
 | 
			
		||||
        $("#user_avatar_upload_button").expectOne(),
 | 
			
		||||
        upload_function,
 | 
			
		||||
        page_params.max_avatar_file_size
 | 
			
		||||
    );
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,5 @@
 | 
			
		||||
/* eslint indent: "off" */
 | 
			
		||||
 | 
			
		||||
var bot_data = (function () {
 | 
			
		||||
    var exports = {};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,5 @@
 | 
			
		||||
/* eslint indent: "off" */
 | 
			
		||||
 | 
			
		||||
var buddy_list = (function () {
 | 
			
		||||
    var self = {};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -49,8 +49,8 @@ exports.password_quality = function (password, bar, password_field) {
 | 
			
		||||
        // The bar bottoms out at 10% so there's always something
 | 
			
		||||
        // for the user to see.
 | 
			
		||||
        bar.width(((90 * bar_progress) + 10) + '%')
 | 
			
		||||
           .removeClass('bar-success bar-danger')
 | 
			
		||||
           .addClass(acceptable ? 'bar-success' : 'bar-danger');
 | 
			
		||||
            .removeClass('bar-success bar-danger')
 | 
			
		||||
            .addClass(acceptable ? 'bar-success' : 'bar-danger');
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return acceptable;
 | 
			
		||||
 
 | 
			
		||||
@@ -167,8 +167,8 @@ exports.create_message_object = create_message_object;
 | 
			
		||||
 | 
			
		||||
function compose_error(error_text, bad_input) {
 | 
			
		||||
    $('#compose-send-status').removeClass(common.status_classes)
 | 
			
		||||
               .addClass('alert-error')
 | 
			
		||||
               .stop(true).fadeTo(0, 1);
 | 
			
		||||
        .addClass('alert-error')
 | 
			
		||||
        .stop(true).fadeTo(0, 1);
 | 
			
		||||
    $('#compose-error-msg').html(error_text);
 | 
			
		||||
    $("#compose-send-button").prop('disabled', false);
 | 
			
		||||
    $("#sending-indicator").hide();
 | 
			
		||||
@@ -187,8 +187,8 @@ function nonexistent_stream_reply_error() {
 | 
			
		||||
 | 
			
		||||
function compose_not_subscribed_error(error_text, bad_input) {
 | 
			
		||||
    $('#compose-send-status').removeClass(common.status_classes)
 | 
			
		||||
               .addClass('home-error-bar')
 | 
			
		||||
               .stop(true).fadeTo(0, 1);
 | 
			
		||||
        .addClass('home-error-bar')
 | 
			
		||||
        .stop(true).fadeTo(0, 1);
 | 
			
		||||
    $('#compose-error-msg').html(error_text);
 | 
			
		||||
    $("#compose-send-button").prop('disabled', false);
 | 
			
		||||
    $("#sending-indicator").hide();
 | 
			
		||||
@@ -369,7 +369,7 @@ exports.schedule_message = function schedule_message(request, success, error) {
 | 
			
		||||
    request = patch_request_for_scheduling(request);
 | 
			
		||||
 | 
			
		||||
    if (request === undefined) {
 | 
			
		||||
       return;
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    transmit.send_message(request, success, error);
 | 
			
		||||
@@ -567,11 +567,11 @@ function validate_stream_message() {
 | 
			
		||||
        }
 | 
			
		||||
    // If either criteria isn't met, just do the normal validation.
 | 
			
		||||
    } else {
 | 
			
		||||
      if (!exports.validate_stream_message_address_info(stream_name) ||
 | 
			
		||||
          !validate_stream_message_mentions(stream_name) ||
 | 
			
		||||
          !validate_stream_message_announce(stream_name)) {
 | 
			
		||||
          return false;
 | 
			
		||||
      }
 | 
			
		||||
        if (!exports.validate_stream_message_address_info(stream_name) ||
 | 
			
		||||
            !validate_stream_message_mentions(stream_name) ||
 | 
			
		||||
            !validate_stream_message_announce(stream_name)) {
 | 
			
		||||
            return false;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return true;
 | 
			
		||||
@@ -740,8 +740,8 @@ exports.initialize = function () {
 | 
			
		||||
    $('#compose-textarea').on('keydown', exports.handle_keydown);
 | 
			
		||||
 | 
			
		||||
    $("#compose form").on("submit", function (e) {
 | 
			
		||||
       e.preventDefault();
 | 
			
		||||
       compose.finish();
 | 
			
		||||
        e.preventDefault();
 | 
			
		||||
        compose.finish();
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    resize.watch_manual_resize("#compose-textarea");
 | 
			
		||||
@@ -957,7 +957,7 @@ exports.initialize = function () {
 | 
			
		||||
                var text = $(this).attr("title");
 | 
			
		||||
                return ":" + text + ":";
 | 
			
		||||
            });
 | 
			
		||||
         }
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    $('#compose').on('click', '#video_link', function (e) {
 | 
			
		||||
 
 | 
			
		||||
@@ -285,8 +285,9 @@ exports.respond_to_message = function (opts) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        msg_type = 'stream'; // Set msg_type to stream by default
 | 
			
		||||
                                 // in the case of an empty home view.
 | 
			
		||||
        // Set msg_type to stream by default in the case of an empty
 | 
			
		||||
        // home view.
 | 
			
		||||
        msg_type = 'stream';
 | 
			
		||||
        if (narrow_state.narrowed_by_pm_reply()) {
 | 
			
		||||
            msg_type = 'private';
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -222,7 +222,7 @@ exports.clear_compose = function () {
 | 
			
		||||
 | 
			
		||||
exports.update_message_list = function () {
 | 
			
		||||
    if (want_normal_display()) {
 | 
			
		||||
       display_messages_normally();
 | 
			
		||||
        display_messages_normally();
 | 
			
		||||
    } else {
 | 
			
		||||
        fade_messages();
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -22,8 +22,8 @@ exports.smart_insert = function (textarea, syntax) {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (!(after_str.length > 0 && is_space(after_str[0]))) {
 | 
			
		||||
            syntax += ' ';
 | 
			
		||||
        }
 | 
			
		||||
        syntax += ' ';
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    textarea.focus();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -377,7 +377,7 @@ exports.compose_content_begins_typeahead = function (query) {
 | 
			
		||||
        var all_items = _.map(['all', 'everyone', 'stream'], function (mention) {
 | 
			
		||||
            return {
 | 
			
		||||
                special_item_text: i18n.t("__wildcard_mention_token__ (Notify stream)",
 | 
			
		||||
                {wildcard_mention_token: mention}),
 | 
			
		||||
                                          {wildcard_mention_token: mention}),
 | 
			
		||||
                email: mention,
 | 
			
		||||
                // Always sort above, under the assumption that names will
 | 
			
		||||
                // be longer and only contain "all" as a substring.
 | 
			
		||||
@@ -526,9 +526,12 @@ exports.compose_matches_sorter = function (matches) {
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        var recipients = typeahead_helper.sort_recipients(users, this.token,
 | 
			
		||||
                                                      compose_state.stream_name(),
 | 
			
		||||
                                                      compose_state.subject(), groups);
 | 
			
		||||
        var recipients = typeahead_helper.sort_recipients(
 | 
			
		||||
            users,
 | 
			
		||||
            this.token,
 | 
			
		||||
            compose_state.stream_name(),
 | 
			
		||||
            compose_state.subject(),
 | 
			
		||||
            groups);
 | 
			
		||||
        return recipients;
 | 
			
		||||
    } else if (this.completing === 'stream') {
 | 
			
		||||
        return typeahead_helper.sort_streams(matches, this.token);
 | 
			
		||||
 
 | 
			
		||||
@@ -37,9 +37,9 @@ function find_boundary_tr(initial_tr, iterate_row) {
 | 
			
		||||
 | 
			
		||||
function construct_recipient_header(message_row) {
 | 
			
		||||
    var message_header_content = rows.get_message_recipient_header(message_row)
 | 
			
		||||
                                     .text()
 | 
			
		||||
                                     .replace(/\s+/g, " ")
 | 
			
		||||
                                     .replace(/^\s/, "").replace(/\s$/, "");
 | 
			
		||||
        .text()
 | 
			
		||||
        .replace(/\s+/g, " ")
 | 
			
		||||
        .replace(/^\s/, "").replace(/\s$/, "");
 | 
			
		||||
    return $('<p>').append($('<strong>').text(message_header_content));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -50,9 +50,7 @@ function construct_copy_div(div, start_id, end_id) {
 | 
			
		||||
    var should_include_start_recipient_header = false;
 | 
			
		||||
 | 
			
		||||
    var last_recipient_row_id = start_recipient_row_id;
 | 
			
		||||
    for (var row = start_row;
 | 
			
		||||
         rows.id(row) <= end_id;
 | 
			
		||||
         row = rows.next_visible(row)) {
 | 
			
		||||
    for (var row = start_row; rows.id(row) <= end_id; row = rows.next_visible(row)) {
 | 
			
		||||
        var recipient_row_id = rows.id_for_recipient_row(rows.get_message_recipient_row(row));
 | 
			
		||||
        // if we found a message from another recipient,
 | 
			
		||||
        // it means that we have messages from several recipients,
 | 
			
		||||
@@ -146,7 +144,7 @@ function copy_handler() {
 | 
			
		||||
    // Select div so that the browser will copy it
 | 
			
		||||
    // instead of copying the original selection
 | 
			
		||||
    div.css({position: 'absolute', left: '-99999px'})
 | 
			
		||||
            .attr('id', 'copytempdiv');
 | 
			
		||||
        .attr('id', 'copytempdiv');
 | 
			
		||||
    $('body').append(div);
 | 
			
		||||
    selection.selectAllChildren(div[0]);
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -139,12 +139,12 @@ exports.restore_draft = function (draft_id) {
 | 
			
		||||
        if (draft.stream !== "") {
 | 
			
		||||
            narrow.activate([{operator: "stream", operand: draft.stream},
 | 
			
		||||
                             {operator: "topic", operand: draft.subject}],
 | 
			
		||||
                             {trigger: "restore draft"});
 | 
			
		||||
                            {trigger: "restore draft"});
 | 
			
		||||
        }
 | 
			
		||||
    } else {
 | 
			
		||||
        if (draft.private_message_recipient !== "") {
 | 
			
		||||
            narrow.activate([{operator: "pm-with", operand: draft.private_message_recipient}],
 | 
			
		||||
                             {trigger: "restore draft"});
 | 
			
		||||
                            {trigger: "restore draft"});
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
@@ -221,7 +221,7 @@ exports.setup_page = function (callback) {
 | 
			
		||||
                var space_string = new Handlebars.SafeString(" ");
 | 
			
		||||
                var stream = (draft.stream.length > 0 ? draft.stream : space_string);
 | 
			
		||||
                var draft_topic = draft.subject.length === 0 ?
 | 
			
		||||
                        compose.empty_topic_placeholder() : draft.subject;
 | 
			
		||||
                    compose.empty_topic_placeholder() : draft.subject;
 | 
			
		||||
 | 
			
		||||
                formatted = {
 | 
			
		||||
                    draft_id: id,
 | 
			
		||||
@@ -277,8 +277,8 @@ exports.setup_page = function (callback) {
 | 
			
		||||
        $('#drafts_table').empty();
 | 
			
		||||
        var drafts = format_drafts(draft_model.get());
 | 
			
		||||
        var rendered = templates.render('draft_table_body',{
 | 
			
		||||
                drafts: drafts,
 | 
			
		||||
                draft_lifetime: DRAFT_LIFETIME,
 | 
			
		||||
            drafts: drafts,
 | 
			
		||||
            draft_lifetime: DRAFT_LIFETIME,
 | 
			
		||||
        });
 | 
			
		||||
        $('#drafts_table').append(rendered);
 | 
			
		||||
        if ($("#drafts_table .draft-row").length > 0) {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,5 @@
 | 
			
		||||
/* eslint indent: "off" */
 | 
			
		||||
 | 
			
		||||
// This is a public instance of the `DynamicText` class.
 | 
			
		||||
// The `DynamicText` object serves to resize text that is set through its
 | 
			
		||||
// public methods so that the text won't ever overrun the parent container.
 | 
			
		||||
 
 | 
			
		||||
@@ -392,8 +392,8 @@ function get_next_emoji_coordinates(move_by) {
 | 
			
		||||
                var prev_multiple = round_off_to_previous_multiple(max_len, 6);
 | 
			
		||||
                next_index =  prev_multiple + current_index;
 | 
			
		||||
                next_index = next_index >= max_len
 | 
			
		||||
                            ? (prev_multiple + current_index - 6)
 | 
			
		||||
                            : next_index;
 | 
			
		||||
                    ? (prev_multiple + current_index - 6)
 | 
			
		||||
                    : next_index;
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    } else if (next_index >= get_max_index(next_section)) {
 | 
			
		||||
 
 | 
			
		||||
@@ -46,8 +46,8 @@ function wrap_quote(text) {
 | 
			
		||||
    _.each(paragraphs, function (paragraph) {
 | 
			
		||||
        var lines = paragraph.split('\n');
 | 
			
		||||
        quoted_paragraphs.push(_.map(
 | 
			
		||||
                                    _.reject(lines, function (line) { return line === ''; }),
 | 
			
		||||
                                    function (line) { return '> ' + line; }).join('\n'));
 | 
			
		||||
            _.reject(lines, function (line) { return line === ''; }),
 | 
			
		||||
            function (line) { return '> ' + line; }).join('\n'));
 | 
			
		||||
    });
 | 
			
		||||
    return quoted_paragraphs.join('\n\n');
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -397,7 +397,7 @@ exports.process_shift_tab_key = function () {
 | 
			
		||||
    var focused_message_edit_save = $(".message_edit_save").filter(":focus");
 | 
			
		||||
    if (focused_message_edit_save.length > 0) {
 | 
			
		||||
        focused_message_edit_save.closest(".message_edit_form")
 | 
			
		||||
                                 .find(".message_edit_content").focus();
 | 
			
		||||
            .find(".message_edit_content").focus();
 | 
			
		||||
        return true;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -192,8 +192,7 @@ function insert_hotspot_into_DOM(hotspot) {
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        // reposition on any event that might update the UI
 | 
			
		||||
        ['resize', 'scroll', 'onkeydown', 'click']
 | 
			
		||||
        .forEach(function (event_name) {
 | 
			
		||||
        ['resize', 'scroll', 'onkeydown', 'click'].forEach(function (event_name) {
 | 
			
		||||
            window.addEventListener(event_name, _.debounce(function () {
 | 
			
		||||
                if (place_icon(hotspot)) {
 | 
			
		||||
                    place_popover(hotspot);
 | 
			
		||||
 
 | 
			
		||||
@@ -107,7 +107,7 @@ exports.create = function (opts) {
 | 
			
		||||
        // input block.
 | 
			
		||||
        appendPill: function (value) {
 | 
			
		||||
            if (value.length === 0) {
 | 
			
		||||
              return;
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            if (value.match(",")) {
 | 
			
		||||
                funcs.insertManyPills(value);
 | 
			
		||||
 
 | 
			
		||||
@@ -71,8 +71,8 @@ exports.initialize = function () {
 | 
			
		||||
        success: function () {
 | 
			
		||||
            $('#submit-invitation').button('reset');
 | 
			
		||||
            invite_status.text(i18n.t('User(s) invited successfully.'))
 | 
			
		||||
                          .addClass('alert-success')
 | 
			
		||||
                          .show();
 | 
			
		||||
                .addClass('alert-success')
 | 
			
		||||
                .show();
 | 
			
		||||
            invitee_emails.val('');
 | 
			
		||||
 | 
			
		||||
            if (page_params.development_environment) {
 | 
			
		||||
@@ -87,8 +87,8 @@ exports.initialize = function () {
 | 
			
		||||
            if (arr.errors === undefined) {
 | 
			
		||||
                // There was a fatal error, no partial processing occurred.
 | 
			
		||||
                invite_status.text(arr.msg)
 | 
			
		||||
                              .addClass('alert-error')
 | 
			
		||||
                              .show();
 | 
			
		||||
                    .addClass('alert-error')
 | 
			
		||||
                    .show();
 | 
			
		||||
            } else {
 | 
			
		||||
                // Some users were not invited.
 | 
			
		||||
                var invitee_emails_errored = [];
 | 
			
		||||
@@ -99,10 +99,10 @@ exports.initialize = function () {
 | 
			
		||||
                });
 | 
			
		||||
 | 
			
		||||
                invite_status.addClass('alert-warning')
 | 
			
		||||
                              .empty()
 | 
			
		||||
                              .append($('<p>').text(arr.msg))
 | 
			
		||||
                              .append(error_list)
 | 
			
		||||
                              .show();
 | 
			
		||||
                    .empty()
 | 
			
		||||
                    .append($('<p>').text(arr.msg))
 | 
			
		||||
                    .append(error_list)
 | 
			
		||||
                    .show();
 | 
			
		||||
                invitee_emails_group.addClass('warning');
 | 
			
		||||
 | 
			
		||||
                if (arr.sent_invitations) {
 | 
			
		||||
 
 | 
			
		||||
@@ -222,7 +222,7 @@ $(function () {
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    $("#lightbox_overlay .download").click(function () {
 | 
			
		||||
      this.blur();
 | 
			
		||||
        this.blur();
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    $("#lightbox_overlay").on("click", ".image-list .image", function () {
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,5 @@
 | 
			
		||||
/* eslint indent: "off" */
 | 
			
		||||
 | 
			
		||||
var LightboxCanvas = (function () {
 | 
			
		||||
    var events = {
 | 
			
		||||
        documentMouseup: [],
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,5 @@
 | 
			
		||||
/* eslint indent: "off" */
 | 
			
		||||
 | 
			
		||||
var list_render = (function () {
 | 
			
		||||
    var DEFAULTS = {
 | 
			
		||||
        INITIAL_RENDER_COUNT: 80,
 | 
			
		||||
 
 | 
			
		||||
@@ -14,12 +14,12 @@ var realm_filter_list = [];
 | 
			
		||||
 | 
			
		||||
// Helper function
 | 
			
		||||
function escape(html, encode) {
 | 
			
		||||
  return html
 | 
			
		||||
    .replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&')
 | 
			
		||||
    .replace(/</g, '<')
 | 
			
		||||
    .replace(/>/g, '>')
 | 
			
		||||
    .replace(/"/g, '"')
 | 
			
		||||
    .replace(/'/g, ''');
 | 
			
		||||
    return html
 | 
			
		||||
        .replace(!encode ? /&(?!#?\w+;)/g : /&/g, '&')
 | 
			
		||||
        .replace(/</g, '<')
 | 
			
		||||
        .replace(/>/g, '>')
 | 
			
		||||
        .replace(/"/g, '"')
 | 
			
		||||
        .replace(/'/g, ''');
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Regexes that match some of our common bugdown markup
 | 
			
		||||
@@ -327,9 +327,8 @@ exports.initialize = function () {
 | 
			
		||||
 | 
			
		||||
    function disable_markdown_regex(rules, name) {
 | 
			
		||||
        rules[name] = {exec: function () {
 | 
			
		||||
                return false;
 | 
			
		||||
            },
 | 
			
		||||
        };
 | 
			
		||||
            return false;
 | 
			
		||||
        }};
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    // Configure the marked markdown parser for our usage
 | 
			
		||||
 
 | 
			
		||||
@@ -572,7 +572,7 @@ exports.delete_message = function (msg_id) {
 | 
			
		||||
            },
 | 
			
		||||
            error: function (xhr) {
 | 
			
		||||
                ui_report.error(i18n.t("Error deleting message"), xhr,
 | 
			
		||||
                    $("#delete-message-error"));
 | 
			
		||||
                                $("#delete-message-error"));
 | 
			
		||||
            },
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -103,17 +103,17 @@ exports.MessageList.prototype = {
 | 
			
		||||
 | 
			
		||||
    select_id: function MessageList_select_id(id, opts) {
 | 
			
		||||
        opts = _.extend({
 | 
			
		||||
                then_scroll: false,
 | 
			
		||||
                target_scroll_offset: undefined,
 | 
			
		||||
                use_closest: false,
 | 
			
		||||
                empty_ok: false,
 | 
			
		||||
                mark_read: true,
 | 
			
		||||
                force_rerender: false,
 | 
			
		||||
            }, opts, {
 | 
			
		||||
                id: id,
 | 
			
		||||
                msg_list: this,
 | 
			
		||||
                previously_selected: this.data.selected_id(),
 | 
			
		||||
            });
 | 
			
		||||
            then_scroll: false,
 | 
			
		||||
            target_scroll_offset: undefined,
 | 
			
		||||
            use_closest: false,
 | 
			
		||||
            empty_ok: false,
 | 
			
		||||
            mark_read: true,
 | 
			
		||||
            force_rerender: false,
 | 
			
		||||
        }, opts, {
 | 
			
		||||
            id: id,
 | 
			
		||||
            msg_list: this,
 | 
			
		||||
            previously_selected: this.data.selected_id(),
 | 
			
		||||
        });
 | 
			
		||||
 | 
			
		||||
        function convert_id(str_id) {
 | 
			
		||||
            var id = parseFloat(str_id);
 | 
			
		||||
 
 | 
			
		||||
@@ -148,8 +148,7 @@ MessageListView.prototype = {
 | 
			
		||||
        }
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    add_subscription_marker: function MessageListView__add_subscription_marker(
 | 
			
		||||
                                group, last_msg_container, first_msg_container) {
 | 
			
		||||
    add_subscription_marker: function (group, last_msg_container, first_msg_container) {
 | 
			
		||||
        if (last_msg_container === undefined) {
 | 
			
		||||
            return;
 | 
			
		||||
        }
 | 
			
		||||
@@ -198,8 +197,8 @@ MessageListView.prototype = {
 | 
			
		||||
                populate_group_from_message_container(current_group,
 | 
			
		||||
                                                      current_group.message_containers[0]);
 | 
			
		||||
                current_group
 | 
			
		||||
                   .message_containers[current_group.message_containers.length - 1]
 | 
			
		||||
                   .include_footer = true;
 | 
			
		||||
                    .message_containers[current_group.message_containers.length - 1]
 | 
			
		||||
                    .include_footer = true;
 | 
			
		||||
                new_message_groups.push(current_group);
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
@@ -349,7 +348,7 @@ MessageListView.prototype = {
 | 
			
		||||
 | 
			
		||||
                new_message_groups = _.initial(new_message_groups);
 | 
			
		||||
            } else if (!same_day(second_group.message_containers[0],
 | 
			
		||||
                       first_group.message_containers[0])) {
 | 
			
		||||
                                 first_group.message_containers[0])) {
 | 
			
		||||
                // The groups did not merge, so we need up update the date row for the old group
 | 
			
		||||
                add_display_time(
 | 
			
		||||
                    second_group,
 | 
			
		||||
@@ -980,8 +979,7 @@ MessageListView.prototype = {
 | 
			
		||||
        trailing_bookend.remove();
 | 
			
		||||
    },
 | 
			
		||||
 | 
			
		||||
    render_trailing_bookend: function MessageListView_render_trailing_bookend(
 | 
			
		||||
                                trailing_bookend_content, subscribed, show_button) {
 | 
			
		||||
    render_trailing_bookend: function (trailing_bookend_content, subscribed, show_button) {
 | 
			
		||||
        var rendered_trailing_bookend = $(templates.render('bookend', {
 | 
			
		||||
            bookend_content: trailing_bookend_content,
 | 
			
		||||
            trailing: show_button,
 | 
			
		||||
 
 | 
			
		||||
@@ -8,7 +8,7 @@ var loading_more_messages_indicator_showing = false;
 | 
			
		||||
exports.show_loading_older = function () {
 | 
			
		||||
    if (! loading_more_messages_indicator_showing) {
 | 
			
		||||
        loading.make_indicator($('#loading_more_messages_indicator'),
 | 
			
		||||
                                    {abs_positioned: true});
 | 
			
		||||
                               {abs_positioned: true});
 | 
			
		||||
        loading_more_messages_indicator_showing = true;
 | 
			
		||||
        floating_recipient_bar.hide();
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -115,9 +115,9 @@ function in_viewport_or_tall(rect, top_of_feed, bottom_of_feed,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function add_to_visible(candidates, visible,
 | 
			
		||||
                                 top_of_feed, bottom_of_feed,
 | 
			
		||||
                                 require_fully_visible,
 | 
			
		||||
                                 row_to_id) {
 | 
			
		||||
                        top_of_feed, bottom_of_feed,
 | 
			
		||||
                        require_fully_visible,
 | 
			
		||||
                        row_to_id) {
 | 
			
		||||
    _.every(candidates, function (row) {
 | 
			
		||||
        var row_rect = row.getBoundingClientRect();
 | 
			
		||||
        // Mark very tall messages as read once we've gotten past them
 | 
			
		||||
@@ -157,11 +157,11 @@ function _visible_divs(selected_row, row_min_height, row_to_output, div_class,
 | 
			
		||||
    var above_pointer = selected_row.prevAll("div." + div_class + ":lt(" + num_neighbors + ")");
 | 
			
		||||
    var below_pointer = selected_row.nextAll("div." + div_class + ":lt(" + num_neighbors + ")");
 | 
			
		||||
    add_to_visible(selected_row, visible, top_of_feed.get(), bottom_of_feed.get(),
 | 
			
		||||
            require_fully_visible, row_to_output);
 | 
			
		||||
                   require_fully_visible, row_to_output);
 | 
			
		||||
    add_to_visible(above_pointer, visible, top_of_feed.get(), bottom_of_feed.get(),
 | 
			
		||||
            require_fully_visible, row_to_output);
 | 
			
		||||
                   require_fully_visible, row_to_output);
 | 
			
		||||
    add_to_visible(below_pointer, visible, top_of_feed.get(), bottom_of_feed.get(),
 | 
			
		||||
            require_fully_visible, row_to_output);
 | 
			
		||||
                   require_fully_visible, row_to_output);
 | 
			
		||||
 | 
			
		||||
    return visible;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -53,18 +53,18 @@ exports.notify_with_undo_option = (function () {
 | 
			
		||||
        var $exit = $("#unmute_muted_topic_notification .exit-me");
 | 
			
		||||
 | 
			
		||||
        if (!meta.$mute) {
 | 
			
		||||
          meta.$mute = $("#unmute_muted_topic_notification");
 | 
			
		||||
            meta.$mute = $("#unmute_muted_topic_notification");
 | 
			
		||||
 | 
			
		||||
          $exit.click(function () {
 | 
			
		||||
              animate.fadeOut();
 | 
			
		||||
          });
 | 
			
		||||
            $exit.click(function () {
 | 
			
		||||
                animate.fadeOut();
 | 
			
		||||
            });
 | 
			
		||||
 | 
			
		||||
          meta.$mute.find("#unmute").click(function () {
 | 
			
		||||
              // it should reference the meta variable and not get stuck with
 | 
			
		||||
              // a pass-by-value of stream, topic.
 | 
			
		||||
              exports.unmute(meta.stream, meta.topic);
 | 
			
		||||
              animate.fadeOut();
 | 
			
		||||
          });
 | 
			
		||||
            meta.$mute.find("#unmute").click(function () {
 | 
			
		||||
                // it should reference the meta variable and not get stuck with
 | 
			
		||||
                // a pass-by-value of stream, topic.
 | 
			
		||||
                exports.unmute(meta.stream, meta.topic);
 | 
			
		||||
                animate.fadeOut();
 | 
			
		||||
            });
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        meta.stream = stream;
 | 
			
		||||
 
 | 
			
		||||
@@ -51,7 +51,7 @@ exports.save_pre_narrow_offset_for_reload = function () {
 | 
			
		||||
                selected_id: current_msg_list.selected_id(),
 | 
			
		||||
                selected_idx: current_msg_list.selected_idx(),
 | 
			
		||||
                selected_idx_exact: current_msg_list._items.indexOf(
 | 
			
		||||
                                        current_msg_list.get(current_msg_list.selected_id())),
 | 
			
		||||
                    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,
 | 
			
		||||
            });
 | 
			
		||||
@@ -250,8 +250,8 @@ exports.activate = function (raw_operators, opts) {
 | 
			
		||||
    stream_list.handle_narrow_activated(current_filter);
 | 
			
		||||
 | 
			
		||||
    $(document).trigger($.Event('narrow_activated.zulip', {msg_list: message_list.narrowed,
 | 
			
		||||
                                                            filter: current_filter,
 | 
			
		||||
                                                            trigger: opts.trigger}));
 | 
			
		||||
                                                           filter: current_filter,
 | 
			
		||||
                                                           trigger: opts.trigger}));
 | 
			
		||||
    msg_list.initial_core_time = new Date();
 | 
			
		||||
    setTimeout(function () {
 | 
			
		||||
        msg_list.initial_free_time = new Date();
 | 
			
		||||
@@ -357,10 +357,11 @@ exports.update_selection = function (opts) {
 | 
			
		||||
 | 
			
		||||
    var then_scroll = !preserve_pre_narrowing_screen_position;
 | 
			
		||||
 | 
			
		||||
    message_list.narrowed.select_id(msg_id, {then_scroll: then_scroll,
 | 
			
		||||
                                             use_closest: true,
 | 
			
		||||
                                             force_rerender: true,
 | 
			
		||||
                                            });
 | 
			
		||||
    message_list.narrowed.select_id(msg_id, {
 | 
			
		||||
        then_scroll: then_scroll,
 | 
			
		||||
        use_closest: true,
 | 
			
		||||
        force_rerender: true,
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    if (preserve_pre_narrowing_screen_position) {
 | 
			
		||||
        // Scroll so that the selected message is in the same
 | 
			
		||||
 
 | 
			
		||||
@@ -56,10 +56,10 @@ function browser_desktop_notifications_on() {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function cancel_notification_object(notification_object) {
 | 
			
		||||
        // We must remove the .onclose so that it does not trigger on .cancel
 | 
			
		||||
        notification_object.onclose = function () {};
 | 
			
		||||
        notification_object.onclick = function () {};
 | 
			
		||||
        notification_object.cancel();
 | 
			
		||||
    // We must remove the .onclose so that it does not trigger on .cancel
 | 
			
		||||
    notification_object.onclose = function () {};
 | 
			
		||||
    notification_object.onclick = function () {};
 | 
			
		||||
    notification_object.cancel();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
exports.get_notifications = function () {
 | 
			
		||||
@@ -71,7 +71,7 @@ exports.initialize = function () {
 | 
			
		||||
        window_has_focus = true;
 | 
			
		||||
 | 
			
		||||
        _.each(notice_memory, function (notice_mem_entry) {
 | 
			
		||||
           cancel_notification_object(notice_mem_entry.obj);
 | 
			
		||||
            cancel_notification_object(notice_mem_entry.obj);
 | 
			
		||||
        });
 | 
			
		||||
        notice_memory = {};
 | 
			
		||||
 | 
			
		||||
@@ -96,13 +96,15 @@ exports.initialize = function () {
 | 
			
		||||
        supports_sound = true;
 | 
			
		||||
        $("#notifications-area").append(audio);
 | 
			
		||||
        if (audio[0].canPlayType('audio/ogg; codecs="vorbis"')) {
 | 
			
		||||
            audio.append($("<source>").attr("type", "audio/ogg")
 | 
			
		||||
                                      .attr("loop", "yes")
 | 
			
		||||
                                      .attr("src", "/static/audio/zulip.ogg"));
 | 
			
		||||
            audio.append(
 | 
			
		||||
                $("<source>").attr("type", "audio/ogg")
 | 
			
		||||
                    .attr("loop", "yes")
 | 
			
		||||
                    .attr("src", "/static/audio/zulip.ogg"));
 | 
			
		||||
        } else {
 | 
			
		||||
            audio.append($("<source>").attr("type", "audio/mpeg")
 | 
			
		||||
                                      .attr("loop", "yes")
 | 
			
		||||
                                      .attr("src", "/static/audio/zulip.mp3"));
 | 
			
		||||
            audio.append(
 | 
			
		||||
                $("<source>").attr("type", "audio/mpeg")
 | 
			
		||||
                    .attr("loop", "yes")
 | 
			
		||||
                    .attr("src", "/static/audio/zulip.mp3"));
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
@@ -338,15 +340,16 @@ function process_notification(notification) {
 | 
			
		||||
 | 
			
		||||
    if (message.type === "stream") {
 | 
			
		||||
        title += " (to " + message.stream + " > " + message.subject + ")";
 | 
			
		||||
        raw_operators = [{operator: "stream", operand: message.stream},
 | 
			
		||||
                         {operator: "topic", operand: message.subject}];
 | 
			
		||||
        raw_operators = [
 | 
			
		||||
            {operator: "stream", operand: message.stream},
 | 
			
		||||
            {operator: "topic", operand: message.subject},
 | 
			
		||||
        ];
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (window.bridge === undefined && notification.webkit_notify === true) {
 | 
			
		||||
        var icon_url = people.small_avatar_url(message);
 | 
			
		||||
        notice_memory[key] = {
 | 
			
		||||
            obj: notifications_api.createNotification(
 | 
			
		||||
                    icon_url, title, content, message.id),
 | 
			
		||||
            obj: notifications_api.createNotification(icon_url, title, content, message.id),
 | 
			
		||||
            msg_count: msg_count,
 | 
			
		||||
            message_id: message.id,
 | 
			
		||||
        };
 | 
			
		||||
@@ -394,10 +397,10 @@ exports.process_notification = process_notification;
 | 
			
		||||
 | 
			
		||||
exports.close_notification = function (message) {
 | 
			
		||||
    _.each(Object.keys(notice_memory), function (key) {
 | 
			
		||||
       if (notice_memory[key].message_id === message.id) {
 | 
			
		||||
           cancel_notification_object(notice_memory[key].obj);
 | 
			
		||||
           delete notice_memory[key];
 | 
			
		||||
       }
 | 
			
		||||
        if (notice_memory[key].message_id === message.id) {
 | 
			
		||||
            cancel_notification_object(notice_memory[key].obj);
 | 
			
		||||
            delete notice_memory[key];
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -126,9 +126,9 @@ exports._build_private_messages_list = function (active_conversation, max_privat
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    var recipients_dom = templates.render('sidebar_private_message_list',
 | 
			
		||||
                                  {messages: display_messages,
 | 
			
		||||
                                   zoom_class: zoom_class,
 | 
			
		||||
                                   want_show_more_messages_links: hiding_messages});
 | 
			
		||||
                                          {messages: display_messages,
 | 
			
		||||
                                           zoom_class: zoom_class,
 | 
			
		||||
                                           want_show_more_messages_links: hiding_messages});
 | 
			
		||||
    return recipients_dom;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@@ -137,8 +137,8 @@ exports.rebuild_recent = function (active_conversation) {
 | 
			
		||||
    if (private_messages_open) {
 | 
			
		||||
        var max_private_messages = 5;
 | 
			
		||||
        var private_li = get_filter_li();
 | 
			
		||||
        var private_messages_dom = exports._build_private_messages_list(active_conversation,
 | 
			
		||||
            max_private_messages);
 | 
			
		||||
        var private_messages_dom = exports._build_private_messages_list(
 | 
			
		||||
            active_conversation, max_private_messages);
 | 
			
		||||
 | 
			
		||||
        private_li.append(private_messages_dom);
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -46,8 +46,8 @@ function copy_email_handler(e) {
 | 
			
		||||
    email_textnode.nodeValue = i18n.t('Email copied');
 | 
			
		||||
 | 
			
		||||
    setTimeout(function () {
 | 
			
		||||
      email_el.removeClass('email_copied');
 | 
			
		||||
      email_textnode.nodeValue = copy_icon.attr('data-clipboard-text');
 | 
			
		||||
        email_el.removeClass('email_copied');
 | 
			
		||||
        email_textnode.nodeValue = copy_icon.attr('data-clipboard-text');
 | 
			
		||||
    }, 1500);
 | 
			
		||||
    e.clearSelection();
 | 
			
		||||
}
 | 
			
		||||
@@ -99,16 +99,16 @@ function user_last_seen_time_status(user_id) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function calculate_info_popover_placement(size, elt) {
 | 
			
		||||
  var ypos = elt.offset().top;
 | 
			
		||||
    var ypos = elt.offset().top;
 | 
			
		||||
 | 
			
		||||
  if (!((ypos + (size / 2) < message_viewport.height()) &&
 | 
			
		||||
      (ypos > (size / 2)))) {
 | 
			
		||||
      if (((ypos + size) < message_viewport.height())) {
 | 
			
		||||
          return 'bottom';
 | 
			
		||||
      } else if (ypos > size) {
 | 
			
		||||
          return 'top';
 | 
			
		||||
      }
 | 
			
		||||
  }
 | 
			
		||||
    if (!((ypos + (size / 2) < message_viewport.height()) &&
 | 
			
		||||
          (ypos > (size / 2)))) {
 | 
			
		||||
        if (((ypos + size) < message_viewport.height())) {
 | 
			
		||||
            return 'bottom';
 | 
			
		||||
        } else if (ypos > size) {
 | 
			
		||||
            return 'top';
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// exporting for testability
 | 
			
		||||
@@ -221,7 +221,7 @@ function fetch_group_members(member_ids) {
 | 
			
		||||
function sort_group_members(members) {
 | 
			
		||||
    return members
 | 
			
		||||
        .sort(function (a, b) {
 | 
			
		||||
              return a.full_name.localeCompare(b.full_name);
 | 
			
		||||
            return a.full_name.localeCompare(b.full_name);
 | 
			
		||||
        });
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,4 @@
 | 
			
		||||
/* eslint indent: "off" */
 | 
			
		||||
import PerfectScrollbar from 'perfect-scrollbar';
 | 
			
		||||
 | 
			
		||||
function registerCodeSection($codeSection) {
 | 
			
		||||
 
 | 
			
		||||
@@ -47,7 +47,7 @@ function adjust_font_sizing() {
 | 
			
		||||
        if ($integration_name.height() > 30) {
 | 
			
		||||
            $integration_name.css('font-size', '1em');
 | 
			
		||||
            if ($integration_name.height() > 30) {
 | 
			
		||||
                 $integration_name.css('font-size', '.95em');
 | 
			
		||||
                $integration_name.css('font-size', '.95em');
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
@@ -382,7 +382,7 @@ function integration_events() {
 | 
			
		||||
        if (document.body.scrollTop > 330) {
 | 
			
		||||
            $('.integration-categories-sidebar').addClass('sticky');
 | 
			
		||||
        } else {
 | 
			
		||||
             $('.integration-categories-sidebar').removeClass('sticky');
 | 
			
		||||
            $('.integration-categories-sidebar').removeClass('sticky');
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -16,8 +16,8 @@ var ScrollTo = function () {
 | 
			
		||||
        // then use that as the scrollTop, else assume it is a selector name
 | 
			
		||||
        // and find the `offsetTop`.
 | 
			
		||||
        var top = /\dpx/.test(sel) ?
 | 
			
		||||
                parseInt(sel, 10) :
 | 
			
		||||
                $("[name='" + sel + "']").offset().top;
 | 
			
		||||
            parseInt(sel, 10) :
 | 
			
		||||
            $("[name='" + sel + "']").offset().top;
 | 
			
		||||
 | 
			
		||||
        $("body").animate({ scrollTop: top + "px" }, 300);
 | 
			
		||||
    });
 | 
			
		||||
@@ -88,16 +88,16 @@ var apps_events = function () {
 | 
			
		||||
            return "android";
 | 
			
		||||
        }
 | 
			
		||||
        if (/iPhone|iPad|iPod/i.test(navigator.userAgent)) {
 | 
			
		||||
             return "ios";
 | 
			
		||||
            return "ios";
 | 
			
		||||
        }
 | 
			
		||||
        if (/Mac/i.test(navigator.userAgent)) {
 | 
			
		||||
             return "mac";
 | 
			
		||||
            return "mac";
 | 
			
		||||
        }
 | 
			
		||||
        if (/Win/i.test(navigator.userAgent)) {
 | 
			
		||||
             return "windows";
 | 
			
		||||
            return "windows";
 | 
			
		||||
        }
 | 
			
		||||
        if (/Linux/i.test(navigator.userAgent)) {
 | 
			
		||||
             return "linux";
 | 
			
		||||
            return "linux";
 | 
			
		||||
        }
 | 
			
		||||
        return "mac"; // if unable to determine OS return Mac by default
 | 
			
		||||
    }
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,4 @@
 | 
			
		||||
/* eslint indent: "off" */
 | 
			
		||||
var realm_icon = (function () {
 | 
			
		||||
 | 
			
		||||
    var exports = {};
 | 
			
		||||
 
 | 
			
		||||
@@ -143,9 +143,9 @@ exports.initialize = function () {
 | 
			
		||||
        try {
 | 
			
		||||
            // TODO: preserve focus
 | 
			
		||||
            compose_actions.start(vars.msg_type, {stream: vars.stream || '',
 | 
			
		||||
                                          subject: vars.subject || '',
 | 
			
		||||
                                          private_message_recipient: vars.recipient || '',
 | 
			
		||||
                                          content: vars.msg || ''});
 | 
			
		||||
                                                  subject: vars.subject || '',
 | 
			
		||||
                                                  private_message_recipient: vars.recipient || '',
 | 
			
		||||
                                                  content: vars.msg || ''});
 | 
			
		||||
            if (send_now) {
 | 
			
		||||
                compose.finish();
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -32,30 +32,30 @@ function getScrollbarWidth() {
 | 
			
		||||
 | 
			
		||||
// Workaround for browsers with fixed scrollbars
 | 
			
		||||
$(function () {
 | 
			
		||||
   var sbWidth = getScrollbarWidth();
 | 
			
		||||
    var sbWidth = getScrollbarWidth();
 | 
			
		||||
 | 
			
		||||
   if (sbWidth > 0) {
 | 
			
		||||
    $(".header").css("left", "-" + sbWidth + "px");
 | 
			
		||||
    $(".header-main").css("left", sbWidth + "px");
 | 
			
		||||
    $(".header-main").css("max-width", (1400 + sbWidth) + "px");
 | 
			
		||||
    $(".header-main .column-middle").css("margin-right", (250 + sbWidth) + "px");
 | 
			
		||||
    if (sbWidth > 0) {
 | 
			
		||||
        $(".header").css("left", "-" + sbWidth + "px");
 | 
			
		||||
        $(".header-main").css("left", sbWidth + "px");
 | 
			
		||||
        $(".header-main").css("max-width", (1400 + sbWidth) + "px");
 | 
			
		||||
        $(".header-main .column-middle").css("margin-right", (250 + sbWidth) + "px");
 | 
			
		||||
 | 
			
		||||
    $(".fixed-app").css("left", "-" + sbWidth + "px");
 | 
			
		||||
    $(".fixed-app .app-main").css("max-width", (1400 + sbWidth) + "px");
 | 
			
		||||
    $(".fixed-app .column-middle").css("margin-left", (250 + sbWidth) + "px");
 | 
			
		||||
        $(".fixed-app").css("left", "-" + sbWidth + "px");
 | 
			
		||||
        $(".fixed-app .app-main").css("max-width", (1400 + sbWidth) + "px");
 | 
			
		||||
        $(".fixed-app .column-middle").css("margin-left", (250 + sbWidth) + "px");
 | 
			
		||||
 | 
			
		||||
    $(".column-right").css("right", sbWidth + "px");
 | 
			
		||||
    $(".app-main .right-sidebar").css({"margin-left": (sbWidth) + "px",
 | 
			
		||||
                                       width: (250 - sbWidth) + "px"});
 | 
			
		||||
        $(".column-right").css("right", sbWidth + "px");
 | 
			
		||||
        $(".app-main .right-sidebar").css({"margin-left": (sbWidth) + "px",
 | 
			
		||||
                                           width: (250 - sbWidth) + "px"});
 | 
			
		||||
 | 
			
		||||
    $("#compose").css("left", "-" + sbWidth + "px");
 | 
			
		||||
    $(".compose-content").css({left: sbWidth + "px",
 | 
			
		||||
                               "margin-right": (250 + sbWidth) + "px"});
 | 
			
		||||
    $("#compose-container").css("max-width", (1400 + sbWidth) + "px");
 | 
			
		||||
        $("#compose").css("left", "-" + sbWidth + "px");
 | 
			
		||||
        $(".compose-content").css({left: sbWidth + "px",
 | 
			
		||||
                                   "margin-right": (250 + sbWidth) + "px"});
 | 
			
		||||
        $("#compose-container").css("max-width", (1400 + sbWidth) + "px");
 | 
			
		||||
 | 
			
		||||
    $("head").append("<style> @media (max-width: 1025px) { .compose-content, .header-main .column-middle { margin-right: " + (7 + sbWidth) + "px !important; } } " +
 | 
			
		||||
                     "@media (max-width: 775px) { .fixed-app .column-middle { margin-left: " + (7 + sbWidth) + "px !important; } } " +
 | 
			
		||||
                     "</style>");
 | 
			
		||||
   }
 | 
			
		||||
        $("head").append("<style> @media (max-width: 1025px) { .compose-content, .header-main .column-middle { margin-right: " + (7 + sbWidth) + "px !important; } } " +
 | 
			
		||||
                         "@media (max-width: 775px) { .fixed-app .column-middle { margin-left: " + (7 + sbWidth) + "px !important; } } " +
 | 
			
		||||
                         "</style>");
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
});
 | 
			
		||||
 
 | 
			
		||||
@@ -102,9 +102,8 @@ exports.initialize = function () {
 | 
			
		||||
    $('#search_exit').on('click', exports.clear_search);
 | 
			
		||||
 | 
			
		||||
    var query = $('#search_query');
 | 
			
		||||
    query.on('focus', exports.focus_search)
 | 
			
		||||
         .on('blur' , function () {
 | 
			
		||||
 | 
			
		||||
    query.on('focus', exports.focus_search);
 | 
			
		||||
    query.on('blur' , function () {
 | 
			
		||||
        // The search query box is a visual cue as to
 | 
			
		||||
        // whether search or narrowing is active.  If
 | 
			
		||||
        // the user blurs the search box, then we should
 | 
			
		||||
 
 | 
			
		||||
@@ -90,13 +90,14 @@ exports.add_custom_profile_fields_to_settings = function () {
 | 
			
		||||
            value = "";
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        var html = templates.render("custom-user-profile-field", {field: field,
 | 
			
		||||
                                                                  field_type: type,
 | 
			
		||||
                                                                  field_value: value,
 | 
			
		||||
                                                                  is_long_text_field: is_long_text,
 | 
			
		||||
                                                                  is_choice_field: is_choice_field,
 | 
			
		||||
                                                                  field_choices: field_choices,
 | 
			
		||||
                                                                  });
 | 
			
		||||
        var html = templates.render("custom-user-profile-field", {
 | 
			
		||||
            field: field,
 | 
			
		||||
            field_type: type,
 | 
			
		||||
            field_value: value,
 | 
			
		||||
            is_long_text_field: is_long_text,
 | 
			
		||||
            is_choice_field: is_choice_field,
 | 
			
		||||
            field_choices: field_choices,
 | 
			
		||||
        });
 | 
			
		||||
        $("#account-settings .custom-profile-fields-form").append(html);
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
 
 | 
			
		||||
@@ -102,7 +102,7 @@ exports.on_load_success = function (invites_data) {
 | 
			
		||||
        if (modal_invite_id !== meta.invite_id) {
 | 
			
		||||
            blueslip.error("Invite revoking canceled due to non-matching fields.");
 | 
			
		||||
            ui_report.message(i18n.t("Resending encountered an error. Please reload and try again."),
 | 
			
		||||
               $("#home-error"), 'alert-error');
 | 
			
		||||
                              $("#home-error"), 'alert-error');
 | 
			
		||||
        }
 | 
			
		||||
        $("#revoke_invite_modal").modal("hide");
 | 
			
		||||
        revoke_button.prop("disabled", true).text(i18n.t("Working…"));
 | 
			
		||||
@@ -124,7 +124,7 @@ exports.on_load_success = function (invites_data) {
 | 
			
		||||
        if (modal_invite_id !== meta.invite_id) {
 | 
			
		||||
            blueslip.error("Invite resending canceled due to non-matching fields.");
 | 
			
		||||
            ui_report.message(i18n.t("Resending encountered an error. Please reload and try again."),
 | 
			
		||||
               $("#home-error"), 'alert-error');
 | 
			
		||||
                              $("#home-error"), 'alert-error');
 | 
			
		||||
        }
 | 
			
		||||
        $("#resend_invite_modal").modal("hide");
 | 
			
		||||
        resend_button.prop("disabled", true).text(i18n.t("Working…"));
 | 
			
		||||
 
 | 
			
		||||
@@ -392,10 +392,12 @@ function update_dependent_subsettings(property_name) {
 | 
			
		||||
        set_create_stream_permission_dropdown();
 | 
			
		||||
    } else if (property_name === 'realm_invite_required') {
 | 
			
		||||
        settings_ui.disable_sub_setting_onchange(page_params.realm_invite_required,
 | 
			
		||||
            "id_realm_invite_by_admins_only", true);
 | 
			
		||||
    } else if (property_name === 'realm_video_chat_provider' || property_name === 'realm_google_hangouts_domain') {
 | 
			
		||||
                                                 "id_realm_invite_by_admins_only", true);
 | 
			
		||||
    } else if (property_name === 'realm_video_chat_provider' ||
 | 
			
		||||
               property_name === 'realm_google_hangouts_domain') {
 | 
			
		||||
        set_video_chat_provider_dropdown();
 | 
			
		||||
    } else if (property_name === 'realm_msg_edit_limit_setting' || property_name === 'realm_message_content_edit_limit_minutes') {
 | 
			
		||||
    } else if (property_name === 'realm_msg_edit_limit_setting' ||
 | 
			
		||||
               property_name === 'realm_message_content_edit_limit_minutes') {
 | 
			
		||||
        set_msg_edit_limit_dropdown();
 | 
			
		||||
    } else if (property_name === 'realm_msg_delete_limit_setting' ||
 | 
			
		||||
        property_name === 'realm_message_content_delete_limit_minutes') {
 | 
			
		||||
@@ -654,9 +656,9 @@ function _set_up() {
 | 
			
		||||
            var add_emoji_permission = $("#id_realm_add_emoji_by_admins_only").val();
 | 
			
		||||
            var new_message_retention_days = $("#id_realm_message_retention_days").val();
 | 
			
		||||
 | 
			
		||||
            if (parseInt(new_message_retention_days, 10).toString() !==
 | 
			
		||||
                new_message_retention_days && new_message_retention_days !== "") {
 | 
			
		||||
                    new_message_retention_days = "";
 | 
			
		||||
            if (parseInt(new_message_retention_days, 10).toString() !== new_message_retention_days
 | 
			
		||||
                && new_message_retention_days !== "") {
 | 
			
		||||
                new_message_retention_days = "";
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            var data = {
 | 
			
		||||
@@ -955,7 +957,7 @@ function _set_up() {
 | 
			
		||||
    $("#id_realm_notifications_stream .dropdown-list-body").on("click keypress", ".stream_name", function (e) {
 | 
			
		||||
        if (e.type === "keypress") {
 | 
			
		||||
            if (e.which === 13) {
 | 
			
		||||
               dropdown_menu.dropdown("toggle");
 | 
			
		||||
                dropdown_menu.dropdown("toggle");
 | 
			
		||||
            } else {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
@@ -1002,7 +1004,7 @@ function _set_up() {
 | 
			
		||||
    $("#id_realm_signup_notifications_stream .dropdown-list-body").on("click keypress", ".stream_name", function (e) {
 | 
			
		||||
        if (e.type === "keypress") {
 | 
			
		||||
            if (e.which === 13) {
 | 
			
		||||
               dropdown_menu.dropdown("toggle");
 | 
			
		||||
                dropdown_menu.dropdown("toggle");
 | 
			
		||||
            } else {
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
 
 | 
			
		||||
@@ -21,8 +21,8 @@ exports.reload = function () {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports.can_edit = function (group_id) {
 | 
			
		||||
   var me = people.get_person_from_user_id(people.my_current_user_id());
 | 
			
		||||
   return (user_groups.is_member_of(group_id, people.my_current_user_id()) || me.is_admin);
 | 
			
		||||
    var me = people.get_person_from_user_id(people.my_current_user_id());
 | 
			
		||||
    return (user_groups.is_member_of(group_id, people.my_current_user_id()) || me.is_admin);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports.populate_user_groups = function () {
 | 
			
		||||
@@ -84,8 +84,7 @@ exports.populate_user_groups = function () {
 | 
			
		||||
            });
 | 
			
		||||
            pill_container.find('.pill').hover(function () {
 | 
			
		||||
                pill_container.find('.pill').find('.exit').css('opacity', '0.5');
 | 
			
		||||
                    }, function () {}
 | 
			
		||||
            );
 | 
			
		||||
            }, function () {});
 | 
			
		||||
        }
 | 
			
		||||
        update_membership(data.id);
 | 
			
		||||
 | 
			
		||||
@@ -119,9 +118,9 @@ exports.populate_user_groups = function () {
 | 
			
		||||
                save_instructions.css({display: 'block', opacity: 0}).fadeTo(400, 1);
 | 
			
		||||
            } else if (!is_user_group_changed() &&
 | 
			
		||||
                cancel_button.is(':visible')) {
 | 
			
		||||
                    cancel_button.fadeOut();
 | 
			
		||||
                    save_instructions.fadeOut();
 | 
			
		||||
                }
 | 
			
		||||
                cancel_button.fadeOut();
 | 
			
		||||
                save_instructions.fadeOut();
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        function show_saved_button() {
 | 
			
		||||
@@ -204,8 +203,8 @@ exports.populate_user_groups = function () {
 | 
			
		||||
            }
 | 
			
		||||
            if ($(event.relatedTarget).closest('#user-groups #' + data.id) &&
 | 
			
		||||
                $(event.relatedTarget).closest('.cancel').length) {
 | 
			
		||||
                    settings_user_groups.reload();
 | 
			
		||||
                    return;
 | 
			
		||||
                settings_user_groups.reload();
 | 
			
		||||
                return;
 | 
			
		||||
            }
 | 
			
		||||
            save_name_desc();
 | 
			
		||||
            save_members();
 | 
			
		||||
 
 | 
			
		||||
@@ -250,7 +250,7 @@ exports.on_load_success = function (realm_people_data) {
 | 
			
		||||
        if ($("#deactivation_user_modal .email").html() !== email) {
 | 
			
		||||
            blueslip.error("User deactivation canceled due to non-matching fields.");
 | 
			
		||||
            ui_report.message(i18n.t("Deactivation encountered an error. Please reload and try again."),
 | 
			
		||||
               $("#home-error"), 'alert-error');
 | 
			
		||||
                              $("#home-error"), 'alert-error');
 | 
			
		||||
        }
 | 
			
		||||
        $("#deactivation_user_modal").modal("hide");
 | 
			
		||||
        meta.current_deactivate_user_modal_row.find("button").eq(0).prop("disabled", true).text(i18n.t("Working…"));
 | 
			
		||||
 
 | 
			
		||||
@@ -32,8 +32,14 @@ function Socket(url) {
 | 
			
		||||
        that._try_to_reconnect({reason: 'unsuspend'});
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    this._supported_protocols = ['websocket', 'xdr-streaming', 'xhr-streaming',
 | 
			
		||||
                                 'xdr-polling', 'xhr-polling', 'jsonp-polling'];
 | 
			
		||||
    this._supported_protocols = [
 | 
			
		||||
        'websocket',
 | 
			
		||||
        'xdr-streaming',
 | 
			
		||||
        'xhr-streaming',
 | 
			
		||||
        'xdr-polling',
 | 
			
		||||
        'xhr-polling',
 | 
			
		||||
        'jsonp-polling',
 | 
			
		||||
    ];
 | 
			
		||||
    if (page_params.test_suite) {
 | 
			
		||||
        this._supported_protocols = _.reject(this._supported_protocols,
 | 
			
		||||
                                             function (x) { return x === 'xhr-streaming'; });
 | 
			
		||||
@@ -209,30 +215,30 @@ Socket.prototype = {
 | 
			
		||||
                               queue_id: page_params.queue_id,
 | 
			
		||||
                               status_inquiries: _.keys(that._requests)};
 | 
			
		||||
                request.success = function (resp) {
 | 
			
		||||
                  that._is_authenticated = true;
 | 
			
		||||
                  that._is_reconnecting = false;
 | 
			
		||||
                  that._reconnect_initiation_time = null;
 | 
			
		||||
                  that._connection_failures = 0;
 | 
			
		||||
                  var resend_queue = [];
 | 
			
		||||
                  _.each(resp.status_inquiries, function (status, id) {
 | 
			
		||||
                    if (status.status === 'complete') {
 | 
			
		||||
                        that._process_response(id, status.response);
 | 
			
		||||
                    } else if (status.status === 'received') {
 | 
			
		||||
                        that._update_request_state(id, 'sent');
 | 
			
		||||
                    } else if (status.status === 'not_received') {
 | 
			
		||||
                        resend_queue.push(id);
 | 
			
		||||
                    }
 | 
			
		||||
                  });
 | 
			
		||||
                  resend_queue.sort(that._req_id_sorter);
 | 
			
		||||
                  _.each(resend_queue, function (id) {
 | 
			
		||||
                      that._resend(id);
 | 
			
		||||
                  });
 | 
			
		||||
                    that._is_authenticated = true;
 | 
			
		||||
                    that._is_reconnecting = false;
 | 
			
		||||
                    that._reconnect_initiation_time = null;
 | 
			
		||||
                    that._connection_failures = 0;
 | 
			
		||||
                    var resend_queue = [];
 | 
			
		||||
                    _.each(resp.status_inquiries, function (status, id) {
 | 
			
		||||
                        if (status.status === 'complete') {
 | 
			
		||||
                            that._process_response(id, status.response);
 | 
			
		||||
                        } else if (status.status === 'received') {
 | 
			
		||||
                            that._update_request_state(id, 'sent');
 | 
			
		||||
                        } else if (status.status === 'not_received') {
 | 
			
		||||
                            resend_queue.push(id);
 | 
			
		||||
                        }
 | 
			
		||||
                    });
 | 
			
		||||
                    resend_queue.sort(that._req_id_sorter);
 | 
			
		||||
                    _.each(resend_queue, function (id) {
 | 
			
		||||
                        that._resend(id);
 | 
			
		||||
                    });
 | 
			
		||||
                };
 | 
			
		||||
                request.error = function (type, resp) {
 | 
			
		||||
                  blueslip.info("Could not authenticate with server: " + resp.msg);
 | 
			
		||||
                  that._connection_failures += 1;
 | 
			
		||||
                  that._try_to_reconnect({reason: 'auth_fail',
 | 
			
		||||
                                          wait_time: that._reconnect_wait_time()});
 | 
			
		||||
                    blueslip.info("Could not authenticate with server: " + resp.msg);
 | 
			
		||||
                    that._connection_failures += 1;
 | 
			
		||||
                    that._try_to_reconnect({reason: 'auth_fail',
 | 
			
		||||
                                            wait_time: that._reconnect_wait_time()});
 | 
			
		||||
                };
 | 
			
		||||
                that._save_request(request);
 | 
			
		||||
                that._do_send(request);
 | 
			
		||||
 
 | 
			
		||||
@@ -5,12 +5,14 @@ var exports = {};
 | 
			
		||||
exports.default_color = "#c2c2c2";
 | 
			
		||||
// Auto-assigned colors should be from the default palette so it's easy to undo
 | 
			
		||||
// changes, so if that palette changes, change these colors.
 | 
			
		||||
var stream_assignment_colors = ["#76ce90", "#fae589", "#a6c7e5", "#e79ab5",
 | 
			
		||||
                                "#bfd56f", "#f4ae55", "#b0a5fd", "#addfe5",
 | 
			
		||||
                                "#f5ce6e", "#c2726a", "#94c849", "#bd86e5",
 | 
			
		||||
                                "#ee7e4a", "#a6dcbf", "#95a5fd", "#53a063",
 | 
			
		||||
                                "#9987e1", "#e4523d", "#c2c2c2", "#4f8de4",
 | 
			
		||||
                                "#c6a8ad", "#e7cc4d", "#c8bebf", "#a47462"];
 | 
			
		||||
var stream_assignment_colors = [
 | 
			
		||||
    "#76ce90", "#fae589", "#a6c7e5", "#e79ab5",
 | 
			
		||||
    "#bfd56f", "#f4ae55", "#b0a5fd", "#addfe5",
 | 
			
		||||
    "#f5ce6e", "#c2726a", "#94c849", "#bd86e5",
 | 
			
		||||
    "#ee7e4a", "#a6dcbf", "#95a5fd", "#53a063",
 | 
			
		||||
    "#9987e1", "#e4523d", "#c2c2c2", "#4f8de4",
 | 
			
		||||
    "#c6a8ad", "#e7cc4d", "#c8bebf", "#a47462",
 | 
			
		||||
];
 | 
			
		||||
 | 
			
		||||
// Classes which could be returned by get_color_class.
 | 
			
		||||
exports.color_classes = 'dark_background';
 | 
			
		||||
@@ -50,7 +52,7 @@ function update_table_stream_color(table, stream_name, color) {
 | 
			
		||||
            var messages = $label.closest(".recipient_row").children(".message_row");
 | 
			
		||||
            messages.children(".messagebox").css("box-shadow", "inset 2px 0px 0px 0px " + style + ", -1px 0px 0px 0px " + style);
 | 
			
		||||
            $label.css({background: style,
 | 
			
		||||
                          "border-left-color": style});
 | 
			
		||||
                        "border-left-color": style});
 | 
			
		||||
            $label.removeClass(exports.color_classes);
 | 
			
		||||
            $label.addClass(color_class);
 | 
			
		||||
        }
 | 
			
		||||
@@ -85,7 +87,8 @@ var subscriptions_table_colorpicker_options = {
 | 
			
		||||
 | 
			
		||||
exports.set_colorpicker_color = function (colorpicker, color) {
 | 
			
		||||
    colorpicker.spectrum(_.extend(subscriptions_table_colorpicker_options,
 | 
			
		||||
                         {color: color, container: "#subscription_overlay .subscription_settings.show"}));
 | 
			
		||||
                                  {color: color,
 | 
			
		||||
                                   container: "#subscription_overlay .subscription_settings.show"}));
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports.update_stream_color = function (sub, color, opts) {
 | 
			
		||||
 
 | 
			
		||||
@@ -178,7 +178,8 @@ function create_stream() {
 | 
			
		||||
 | 
			
		||||
    loading.make_indicator($('#stream_creating_indicator'), {text: i18n.t('Creating stream...')});
 | 
			
		||||
 | 
			
		||||
    ajaxSubscribeForCreation(stream_name,
 | 
			
		||||
    ajaxSubscribeForCreation(
 | 
			
		||||
        stream_name,
 | 
			
		||||
        description,
 | 
			
		||||
        principals,
 | 
			
		||||
        is_invite_only,
 | 
			
		||||
@@ -408,10 +409,11 @@ exports.set_up_handlers = function () {
 | 
			
		||||
 | 
			
		||||
    container.on("mouseover", "#announce-stream-docs", function (e) {
 | 
			
		||||
        var announce_stream_docs = $("#announce-stream-docs");
 | 
			
		||||
        announce_stream_docs.popover({placement: "right",
 | 
			
		||||
                                      content: templates.render('announce_stream_docs', {
 | 
			
		||||
                                        notifications_stream: page_params.notifications_stream}),
 | 
			
		||||
                                      trigger: "manual"});
 | 
			
		||||
        announce_stream_docs.popover({
 | 
			
		||||
            placement: "right",
 | 
			
		||||
            content: templates.render('announce_stream_docs', {
 | 
			
		||||
                notifications_stream: page_params.notifications_stream}),
 | 
			
		||||
            trigger: "manual"});
 | 
			
		||||
        announce_stream_docs.popover('show');
 | 
			
		||||
        announce_stream_docs.data('popover').tip().css('z-index', 2000);
 | 
			
		||||
        announce_stream_docs.data('popover').tip().find('.popover-content').css('margin', '9px 14px');
 | 
			
		||||
 
 | 
			
		||||
@@ -224,16 +224,15 @@ exports.all_subscribed_streams_are_in_home_view = function () {
 | 
			
		||||
 | 
			
		||||
exports.home_view_stream_names = function () {
 | 
			
		||||
    var home_view_subs = _.filter(exports.subscribed_subs(), function (sub) {
 | 
			
		||||
            return sub.in_home_view;
 | 
			
		||||
        }
 | 
			
		||||
    );
 | 
			
		||||
        return sub.in_home_view;
 | 
			
		||||
    });
 | 
			
		||||
    return _.map(home_view_subs, function (sub) {
 | 
			
		||||
        return sub.name;
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports.canonicalized_name = function (stream_name) {
 | 
			
		||||
   return stream_name.toString().toLowerCase();
 | 
			
		||||
    return stream_name.toString().toLowerCase();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports.get_color = function (stream_name) {
 | 
			
		||||
@@ -554,7 +553,8 @@ exports.get_newbie_stream = function () {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports.remove_default_stream = function (stream_id) {
 | 
			
		||||
    page_params.realm_default_streams = _.reject(page_params.realm_default_streams,
 | 
			
		||||
    page_params.realm_default_streams = _.reject(
 | 
			
		||||
        page_params.realm_default_streams,
 | 
			
		||||
        function (stream) {
 | 
			
		||||
            return stream.stream_id === stream_id;
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -449,7 +449,7 @@ exports.change_stream_description = function (e) {
 | 
			
		||||
        success: function () {
 | 
			
		||||
            // The event from the server will update the rest of the UI
 | 
			
		||||
            ui_report.success(i18n.t("The stream description has been updated!"),
 | 
			
		||||
                             $(".stream_change_property_info"));
 | 
			
		||||
                              $(".stream_change_property_info"));
 | 
			
		||||
        },
 | 
			
		||||
        error: function (xhr) {
 | 
			
		||||
            sub_settings.find('.stream-description-editable').html(sub.rendered_description);
 | 
			
		||||
@@ -538,13 +538,12 @@ $(function () {
 | 
			
		||||
                stream_subscription_info_elem.text(i18n.t("User already subscribed."));
 | 
			
		||||
            }
 | 
			
		||||
            stream_subscription_info_elem.addClass("text-success")
 | 
			
		||||
                                         .removeClass("text-error");
 | 
			
		||||
                .removeClass("text-error");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        function invite_failure() {
 | 
			
		||||
            stream_subscription_info_elem.text(i18n.t("Could not add user to this stream."))
 | 
			
		||||
                                         .addClass("text-error")
 | 
			
		||||
                                         .removeClass("text-success");
 | 
			
		||||
                .addClass("text-error").removeClass("text-success");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        exports.invite_user_to_stream(principal, sub, invite_success, invite_failure);
 | 
			
		||||
@@ -574,14 +573,13 @@ $(function () {
 | 
			
		||||
                stream_subscription_info_elem.text(i18n.t("User is already not subscribed."));
 | 
			
		||||
            }
 | 
			
		||||
            stream_subscription_info_elem.addClass('text-success')
 | 
			
		||||
                                         .removeClass('text-error');
 | 
			
		||||
                .removeClass('text-error');
 | 
			
		||||
            ui.update_scrollbar($("#subscription_overlay .settings"));
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        function removal_failure() {
 | 
			
		||||
            stream_subscription_info_elem.text(i18n.t("Error removing user from this stream."))
 | 
			
		||||
                                         .addClass("text-error")
 | 
			
		||||
                                         .removeClass("text-success");
 | 
			
		||||
                .addClass("text-error").removeClass("text-success");
 | 
			
		||||
        }
 | 
			
		||||
 | 
			
		||||
        exports.remove_user_from_stream(principal, sub, removal_success,
 | 
			
		||||
 
 | 
			
		||||
@@ -37,8 +37,8 @@ exports.update_property = function (stream_id, property, value) {
 | 
			
		||||
    if (sub === undefined) {
 | 
			
		||||
        // This isn't a stream we know about, so ignore it.
 | 
			
		||||
        blueslip.warn("Update for an unknown subscription", {stream_id: stream_id,
 | 
			
		||||
                                                            property: property,
 | 
			
		||||
                                                            value: value});
 | 
			
		||||
                                                             property: property,
 | 
			
		||||
                                                             value: value});
 | 
			
		||||
        return;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -215,14 +215,15 @@ exports.set_in_home_view = function (stream_id, in_home) {
 | 
			
		||||
 | 
			
		||||
function build_stream_sidebar_li(sub) {
 | 
			
		||||
    var name = sub.name;
 | 
			
		||||
    var args = {name: name,
 | 
			
		||||
                id: sub.stream_id,
 | 
			
		||||
                uri: narrow.by_stream_uri(name),
 | 
			
		||||
                not_in_home_view: (stream_data.in_home_view(sub.stream_id) === false),
 | 
			
		||||
                invite_only: sub.invite_only,
 | 
			
		||||
                color: stream_data.get_color(name),
 | 
			
		||||
                pin_to_top: sub.pin_to_top,
 | 
			
		||||
               };
 | 
			
		||||
    var args = {
 | 
			
		||||
        name: name,
 | 
			
		||||
        id: sub.stream_id,
 | 
			
		||||
        uri: narrow.by_stream_uri(name),
 | 
			
		||||
        not_in_home_view: (stream_data.in_home_view(sub.stream_id) === false),
 | 
			
		||||
        invite_only: sub.invite_only,
 | 
			
		||||
        color: stream_data.get_color(name),
 | 
			
		||||
        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));
 | 
			
		||||
    return list_item;
 | 
			
		||||
 
 | 
			
		||||
@@ -195,14 +195,9 @@ function build_all_messages_popover(e) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
exports.register_click_handlers = function () {
 | 
			
		||||
    $('#stream_filters').on('click',
 | 
			
		||||
        '.stream-sidebar-arrow', build_stream_popover);
 | 
			
		||||
 | 
			
		||||
    $('#stream_filters').on('click',
 | 
			
		||||
        '.topic-sidebar-arrow', build_topic_popover);
 | 
			
		||||
 | 
			
		||||
    $('#global_filters').on('click',
 | 
			
		||||
        '.stream-sidebar-arrow', build_all_messages_popover);
 | 
			
		||||
    $('#stream_filters').on('click', '.stream-sidebar-arrow', build_stream_popover);
 | 
			
		||||
    $('#stream_filters').on('click', '.topic-sidebar-arrow', build_topic_popover);
 | 
			
		||||
    $('#global_filters').on('click', '.stream-sidebar-arrow', build_all_messages_popover);
 | 
			
		||||
 | 
			
		||||
    exports.register_stream_handlers();
 | 
			
		||||
    exports.register_topic_handlers();
 | 
			
		||||
 
 | 
			
		||||
@@ -71,8 +71,8 @@ function export_hash(hash) {
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function selectText(element) {
 | 
			
		||||
  var range;
 | 
			
		||||
  var sel;
 | 
			
		||||
    var range;
 | 
			
		||||
    var sel;
 | 
			
		||||
    if (window.getSelection) {
 | 
			
		||||
        sel = window.getSelection();
 | 
			
		||||
        range = document.createRange();
 | 
			
		||||
@@ -375,7 +375,7 @@ exports.filter_table = function (query) {
 | 
			
		||||
            exports.stream_description_match_stream_ids.push(sub.stream_id);
 | 
			
		||||
 | 
			
		||||
            widgets[sub.stream_id] = $(row).detach();
 | 
			
		||||
       } else {
 | 
			
		||||
        } else {
 | 
			
		||||
            $(row).addClass("notdisplayed");
 | 
			
		||||
            others.push($(row).detach());
 | 
			
		||||
        }
 | 
			
		||||
 
 | 
			
		||||
@@ -59,7 +59,7 @@ function make_tab_data() {
 | 
			
		||||
                   filter.has_operand("is", "private")) {
 | 
			
		||||
 | 
			
		||||
            tabs.push(make_tab("Private Messages", '#narrow/is/private',
 | 
			
		||||
                                undefined, 'private_message '));
 | 
			
		||||
                               undefined, 'private_message '));
 | 
			
		||||
 | 
			
		||||
            if (filter.has_operator("pm-with")) {
 | 
			
		||||
                var emails = filter.operands("pm-with")[0].split(',');
 | 
			
		||||
@@ -76,7 +76,7 @@ function make_tab_data() {
 | 
			
		||||
        } else if (filter.has_operator("group-pm-with")) {
 | 
			
		||||
 | 
			
		||||
            tabs.push(make_tab("Group Private", '#narrow/group-pm-with',
 | 
			
		||||
                                undefined, 'private_message '));
 | 
			
		||||
                               undefined, 'private_message '));
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
        } else if (filter.has_operand("is", "starred")) {
 | 
			
		||||
@@ -131,19 +131,19 @@ exports.colorize_tab_bar = function () {
 | 
			
		||||
        var color_for_stream = stream_data.get_color(stream_name);
 | 
			
		||||
        var stream_dark = stream_color.get_color_class(color_for_stream);
 | 
			
		||||
        var stream_light = colorspace.getHexColor(
 | 
			
		||||
                           colorspace.getLighterColor(
 | 
			
		||||
                           colorspace.getDecimalColor(color_for_stream), 0.2));
 | 
			
		||||
            colorspace.getLighterColor(
 | 
			
		||||
                colorspace.getDecimalColor(color_for_stream), 0.2));
 | 
			
		||||
 | 
			
		||||
        if (stream_tab.hasClass("stream")) {
 | 
			
		||||
            stream_tab.css('background-color', color_for_stream);
 | 
			
		||||
            if (stream_tab.hasClass("inactive")) {
 | 
			
		||||
              stream_tab.hover (
 | 
			
		||||
                function () {
 | 
			
		||||
                 $(this).css('background-color', stream_light);
 | 
			
		||||
                }, function () {
 | 
			
		||||
                 $(this).css('background-color', color_for_stream);
 | 
			
		||||
                }
 | 
			
		||||
              );
 | 
			
		||||
                stream_tab.hover (
 | 
			
		||||
                    function () {
 | 
			
		||||
                        $(this).css('background-color', stream_light);
 | 
			
		||||
                    }, function () {
 | 
			
		||||
                        $(this).css('background-color', color_for_stream);
 | 
			
		||||
                    }
 | 
			
		||||
                );
 | 
			
		||||
            }
 | 
			
		||||
            stream_tab.removeClass(stream_color.color_classes);
 | 
			
		||||
            stream_tab.addClass(stream_dark);
 | 
			
		||||
 
 | 
			
		||||
@@ -65,7 +65,7 @@ exports.render_now = function (time, today) {
 | 
			
		||||
// Current date is passed as an argument for unit testing
 | 
			
		||||
exports.last_seen_status_from_date = function (last_active_date, current_date) {
 | 
			
		||||
    if (typeof  current_date === 'undefined') {
 | 
			
		||||
         current_date = new XDate();
 | 
			
		||||
        current_date = new XDate();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    var minutes = Math.floor(last_active_date.diffMinutes(current_date));
 | 
			
		||||
@@ -78,7 +78,7 @@ exports.last_seen_status_from_date = function (last_active_date, current_date) {
 | 
			
		||||
 | 
			
		||||
    var hours = Math.floor(minutes / 60);
 | 
			
		||||
    if (hours === 1) {
 | 
			
		||||
         return i18n.t("Last seen an hour ago");
 | 
			
		||||
        return i18n.t("Last seen an hour ago");
 | 
			
		||||
    }
 | 
			
		||||
    if (hours < 24) {
 | 
			
		||||
        return i18n.t("Last seen __hours__ hours ago", {hours: hours});
 | 
			
		||||
@@ -155,10 +155,10 @@ exports.render_date = function (time, time_above, today) {
 | 
			
		||||
        node = render_date_span(node, rendered_time);
 | 
			
		||||
    }
 | 
			
		||||
    maybe_add_update_list_entry({
 | 
			
		||||
      needs_update: rendered_time.needs_update,
 | 
			
		||||
      className: className,
 | 
			
		||||
      time: time,
 | 
			
		||||
      time_above: time_above,
 | 
			
		||||
        needs_update: rendered_time.needs_update,
 | 
			
		||||
        className: className,
 | 
			
		||||
        time: time,
 | 
			
		||||
        time_above: time_above,
 | 
			
		||||
    });
 | 
			
		||||
    return node;
 | 
			
		||||
};
 | 
			
		||||
@@ -245,7 +245,7 @@ exports.absolute_time = (function () {
 | 
			
		||||
 | 
			
		||||
    return function (timestamp, today) {
 | 
			
		||||
        if (typeof today === 'undefined') {
 | 
			
		||||
             today = new Date();
 | 
			
		||||
            today = new Date();
 | 
			
		||||
        }
 | 
			
		||||
        var date = new Date(timestamp);
 | 
			
		||||
        var is_older_year = (today.getFullYear() - date.getFullYear()) > 0;
 | 
			
		||||
 
 | 
			
		||||
@@ -90,8 +90,8 @@ exports.wrap = function (lst, val) {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    var inners = [
 | 
			
		||||
         exports.sub_list_generator(lst, i, lst.length),
 | 
			
		||||
         exports.sub_list_generator(lst, 0, i),
 | 
			
		||||
        exports.sub_list_generator(lst, i, lst.length),
 | 
			
		||||
        exports.sub_list_generator(lst, 0, i),
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    return exports.chain(inners);
 | 
			
		||||
@@ -108,8 +108,8 @@ exports.wrap_exclude = function (lst, val) {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    var inners = [
 | 
			
		||||
         exports.sub_list_generator(lst, i+1, lst.length),
 | 
			
		||||
         exports.sub_list_generator(lst, 0, i),
 | 
			
		||||
        exports.sub_list_generator(lst, i+1, lst.length),
 | 
			
		||||
        exports.sub_list_generator(lst, 0, i),
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    return exports.chain(inners);
 | 
			
		||||
@@ -126,8 +126,8 @@ exports.reverse_wrap_exclude = function (lst, val) {
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    var inners = [
 | 
			
		||||
         exports.reverse_sub_list_generator(lst, 0, i),
 | 
			
		||||
         exports.reverse_sub_list_generator(lst, i+1, lst.length),
 | 
			
		||||
        exports.reverse_sub_list_generator(lst, 0, i),
 | 
			
		||||
        exports.reverse_sub_list_generator(lst, i+1, lst.length),
 | 
			
		||||
    ];
 | 
			
		||||
 | 
			
		||||
    return exports.chain(inners);
 | 
			
		||||
 
 | 
			
		||||
@@ -301,8 +301,9 @@ exports.set_click_handlers = function (callbacks) {
 | 
			
		||||
        var sub = stream_data.get_sub_by_id(stream_id);
 | 
			
		||||
        var topic = $(e.target).parents('li').attr('data-topic-name');
 | 
			
		||||
 | 
			
		||||
        narrow.activate([{operator: 'stream', operand: sub.name},
 | 
			
		||||
                         {operator: 'topic', operand: topic}],
 | 
			
		||||
        narrow.activate([
 | 
			
		||||
            {operator: 'stream', operand: sub.name},
 | 
			
		||||
            {operator: 'topic', operand: topic}],
 | 
			
		||||
                        {trigger: 'sidebar'});
 | 
			
		||||
 | 
			
		||||
        e.preventDefault();
 | 
			
		||||
 
 | 
			
		||||
@@ -154,8 +154,8 @@ exports.render_emoji = function (item) {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports.sorter = function (query, objs, get_item) {
 | 
			
		||||
   var results = util.prefix_sort(query, objs, get_item);
 | 
			
		||||
   return results.matches.concat(results.rest);
 | 
			
		||||
    var results = util.prefix_sort(query, objs, get_item);
 | 
			
		||||
    return results.matches.concat(results.rest);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports.compare_by_pms = function (user_a, user_b) {
 | 
			
		||||
@@ -273,8 +273,8 @@ exports.sort_languages = function (matches, query) {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports.sort_recipients = function (users, query, current_stream, current_subject, groups) {
 | 
			
		||||
    var users_name_results =  util.prefix_sort(query, users,
 | 
			
		||||
        function (x) { return x.full_name; });
 | 
			
		||||
    var users_name_results =  util.prefix_sort(
 | 
			
		||||
        query, users, function (x) { return x.full_name; });
 | 
			
		||||
    var result = exports.sort_for_at_mentioning(
 | 
			
		||||
        users_name_results.matches,
 | 
			
		||||
        current_stream,
 | 
			
		||||
@@ -288,7 +288,7 @@ exports.sort_recipients = function (users, query, current_stream, current_subjec
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    var email_results = util.prefix_sort(query, users_name_results.rest,
 | 
			
		||||
        function (x) { return x.email; });
 | 
			
		||||
                                         function (x) { return x.email; });
 | 
			
		||||
    result = result.concat(exports.sort_for_at_mentioning(
 | 
			
		||||
        email_results.matches,
 | 
			
		||||
        current_stream,
 | 
			
		||||
 
 | 
			
		||||
@@ -192,8 +192,9 @@ $(function () {
 | 
			
		||||
                // Scroll to place the message within the current view;
 | 
			
		||||
                // but if this is the initial placement of the pointer,
 | 
			
		||||
                // just place it in the very center
 | 
			
		||||
                message_viewport.recenter_view(row, {from_scroll: event.from_scroll,
 | 
			
		||||
                                    force_center: event.previously_selected === -1});
 | 
			
		||||
                message_viewport.recenter_view(row,
 | 
			
		||||
                                               {from_scroll: event.from_scroll,
 | 
			
		||||
                                                force_center: event.previously_selected === -1});
 | 
			
		||||
            }
 | 
			
		||||
        }
 | 
			
		||||
    });
 | 
			
		||||
@@ -205,17 +206,17 @@ $(function () {
 | 
			
		||||
        timerender.set_full_datetime(message, time_elem);
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    $('#streams_header h4').tooltip({ placement: 'right',
 | 
			
		||||
                                       animation: false });
 | 
			
		||||
    $('#streams_header h4').tooltip({placement: 'right',
 | 
			
		||||
                                     animation: false});
 | 
			
		||||
 | 
			
		||||
    $('#streams_header i[data-toggle="tooltip"]').tooltip({ placement: 'left',
 | 
			
		||||
                                       animation: false });
 | 
			
		||||
    $('#streams_header i[data-toggle="tooltip"]').tooltip({placement: 'left',
 | 
			
		||||
                                                           animation: false});
 | 
			
		||||
 | 
			
		||||
    $('#userlist-header #userlist-title').tooltip({ placement: 'right',
 | 
			
		||||
                                       animation: false });
 | 
			
		||||
    $('#userlist-header #userlist-title').tooltip({placement: 'right',
 | 
			
		||||
                                                   animation: false});
 | 
			
		||||
 | 
			
		||||
    $('#userlist-header #user_filter_icon').tooltip({ placement: 'left',
 | 
			
		||||
                                       animation: false });
 | 
			
		||||
    $('#userlist-header #user_filter_icon').tooltip({placement: 'left',
 | 
			
		||||
                                                     animation: false});
 | 
			
		||||
 | 
			
		||||
    $('.message_failed i[data-toggle="tooltip"]').tooltip();
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -21,7 +21,7 @@ exports.message = function (response, status_box, cls, type, remove_after) {
 | 
			
		||||
    // Note we use html() below, since we can rely on our callers escaping HTML
 | 
			
		||||
    // via i18n.t when interpolating data.
 | 
			
		||||
    status_box.removeClass(common.status_classes).addClass(cls)
 | 
			
		||||
              .html(response).stop(true).fadeTo(0, 1);
 | 
			
		||||
        .html(response).stop(true).fadeTo(0, 1);
 | 
			
		||||
    if (remove_after) {
 | 
			
		||||
        setTimeout(function () {
 | 
			
		||||
            status_box.fadeTo(200, 0);
 | 
			
		||||
@@ -31,12 +31,12 @@ exports.message = function (response, status_box, cls, type, remove_after) {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
function escape(html) {
 | 
			
		||||
  return html
 | 
			
		||||
    .toString()
 | 
			
		||||
    .replace(/</g, '<')
 | 
			
		||||
    .replace(/>/g, '>')
 | 
			
		||||
    .replace(/"/g, '"')
 | 
			
		||||
    .replace(/'/g, ''');
 | 
			
		||||
    return html
 | 
			
		||||
        .toString()
 | 
			
		||||
        .replace(/</g, '<')
 | 
			
		||||
        .replace(/>/g, '>')
 | 
			
		||||
        .replace(/"/g, '"')
 | 
			
		||||
        .replace(/'/g, ''');
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
exports.error = function (response, xhr, status_box, type) {
 | 
			
		||||
 
 | 
			
		||||
@@ -106,18 +106,20 @@ exports.mark_current_list_as_read = function (options) {
 | 
			
		||||
 | 
			
		||||
exports.mark_stream_as_read = function (stream_id, cont) {
 | 
			
		||||
    channel.post({
 | 
			
		||||
        url:      '/json/mark_stream_as_read',
 | 
			
		||||
        url: '/json/mark_stream_as_read',
 | 
			
		||||
        idempotent: true,
 | 
			
		||||
        data:     {stream_id: stream_id},
 | 
			
		||||
        success:  cont});
 | 
			
		||||
        data: {stream_id: stream_id},
 | 
			
		||||
        success: cont,
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports.mark_topic_as_read = function (stream_id, topic, cont) {
 | 
			
		||||
    channel.post({
 | 
			
		||||
    url:      '/json/mark_topic_as_read',
 | 
			
		||||
    idempotent: true,
 | 
			
		||||
    data:     {stream_id: stream_id, topic_name: topic},
 | 
			
		||||
    success:  cont});
 | 
			
		||||
        url: '/json/mark_topic_as_read',
 | 
			
		||||
        idempotent: true,
 | 
			
		||||
        data: {stream_id: stream_id, topic_name: topic},
 | 
			
		||||
        success: cont,
 | 
			
		||||
    });
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -65,7 +65,7 @@ exports.update_unread_counts = function () {
 | 
			
		||||
    notifications.update_pm_count(res.private_message_count);
 | 
			
		||||
 | 
			
		||||
    exports.set_count_toggle_button($("#streamlist-toggle-unreadcount"),
 | 
			
		||||
                                      res.home_unread_messages);
 | 
			
		||||
                                    res.home_unread_messages);
 | 
			
		||||
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
@@ -109,7 +109,7 @@ function _initialize() {
 | 
			
		||||
        $("#yes-bankrupt").hide();
 | 
			
		||||
        $("#no-bankrupt").hide();
 | 
			
		||||
        $(this).after($("<div>").addClass("alert alert-info settings_committed")
 | 
			
		||||
                      .text(i18n.t("Bringing you to your latest messages…")));
 | 
			
		||||
            .text(i18n.t("Bringing you to your latest messages…")));
 | 
			
		||||
    });
 | 
			
		||||
 | 
			
		||||
    consider_bankruptcy();
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,4 @@
 | 
			
		||||
/* eslint indent: "off" */
 | 
			
		||||
var upload_widget = (function () {
 | 
			
		||||
 | 
			
		||||
    var exports = {};
 | 
			
		||||
 
 | 
			
		||||
@@ -68,8 +68,8 @@ exports.update_person = function update(person) {
 | 
			
		||||
        people.set_custom_profile_field_data(person.user_id, person.custom_profile_field);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
     if (_.has(person, 'timezone')) {
 | 
			
		||||
         person_obj.timezone = person.timezone;
 | 
			
		||||
    if (_.has(person, 'timezone')) {
 | 
			
		||||
        person_obj.timezone = person.timezone;
 | 
			
		||||
    }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -48,7 +48,7 @@ exports.create_item_from_email = function (email, current_items) {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports.get_email_from_item = function (item) {
 | 
			
		||||
  return item.email;
 | 
			
		||||
    return item.email;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
exports.append_person = function (opts) {
 | 
			
		||||
 
 | 
			
		||||
@@ -2,8 +2,11 @@
 | 
			
		||||
// global variables from Zulip (everything is being moved into
 | 
			
		||||
// modules).  Please don't add things here.
 | 
			
		||||
 | 
			
		||||
var home_msg_list = new message_list.MessageList('zhome',
 | 
			
		||||
    new Filter([{operator: "in", operand: "home"}]), {muting_enabled: true}
 | 
			
		||||
var home_msg_list = new message_list.MessageList(
 | 
			
		||||
    'zhome',
 | 
			
		||||
    new Filter([{operator: "in",
 | 
			
		||||
                 operand: "home"}]),
 | 
			
		||||
    {muting_enabled: true}
 | 
			
		||||
);
 | 
			
		||||
var current_msg_list = home_msg_list;
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user