diff --git a/.eslintrc.json b/.eslintrc.json index 542a5cfa99..c498c60d62 100644 --- a/.eslintrc.json +++ b/.eslintrc.json @@ -167,7 +167,7 @@ "new-parens": 2, "one-var": ["error", "never"], "quotes": [1, "single"], - "quote-props": 0, + "quote-props": ["error", "as-needed", { "keywords": false, "unnecessary": true, "numbers": false }], "radix": 2, "semi": 2, "keyword-spacing": ["error", { diff --git a/frontend_tests/casper_tests/06-settings.js b/frontend_tests/casper_tests/06-settings.js index 51b8d6d4f3..5b74057a9b 100644 --- a/frontend_tests/casper_tests/06-settings.js +++ b/frontend_tests/casper_tests/06-settings.js @@ -41,10 +41,10 @@ casper.then(function () { casper.test.assertEqual(casper.getFormValues(form_sel).full_name, "Iago"); casper.fill(form_sel, { - "full_name": "IagoNew", - "old_password": test_credentials.default_user.password, - "new_password": "qwertyuiop", - "confirm_password": "qwertyuiop" + full_name: "IagoNew", + old_password: test_credentials.default_user.password, + new_password: "qwertyuiop", + confirm_password: "qwertyuiop" }); casper.click('input[name="change_settings"]'); }); @@ -61,7 +61,7 @@ casper.then(function () { casper.then(function () { casper.waitUntilVisible('#get_api_key_password', function () { - casper.fill('form[action^="/json/fetch_api_key"]', {'password':'qwertyuiop'}); + casper.fill('form[action^="/json/fetch_api_key"]', {password:'qwertyuiop'}); casper.click('input[name="view_api_key"]'); }); }); @@ -72,10 +72,10 @@ casper.then(function () { // Change it all back so the next test can still log in casper.fill(form_sel, { - "full_name": "Iago", - "old_password": "qwertyuiop", - "new_password": test_credentials.default_user.password, - "confirm_password": test_credentials.default_user.password + full_name: "Iago", + old_password: "qwertyuiop", + new_password: test_credentials.default_user.password, + confirm_password: test_credentials.default_user.password }); casper.click('input[name="change_settings"]'); }); diff --git a/frontend_tests/casper_tests/10-admin.js b/frontend_tests/casper_tests/10-admin.js index f11ef15d2a..3622e4021e 100644 --- a/frontend_tests/casper_tests/10-admin.js +++ b/frontend_tests/casper_tests/10-admin.js @@ -150,8 +150,8 @@ casper.then(function () { // Test custom realm emoji casper.waitForSelector('.admin-emoji-form', function () { casper.fill('form.admin-emoji-form', { - 'name': 'MouseFace', - 'url': 'http://zulipdev.com:9991/static/images/integrations/logos/jenkins.png' + name: 'MouseFace', + url: 'http://zulipdev.com:9991/static/images/integrations/logos/jenkins.png' }); casper.click('form.admin-emoji-form input.button'); }); @@ -180,8 +180,8 @@ casper.then(function () { // Test custom realm filters casper.waitForSelector('.admin-filter-form', function () { casper.fill('form.admin-filter-form', { - 'pattern': '#(?P[0-9]+)', - 'url_format_string': 'https://trac.example.com/ticket/%(id)s' + pattern: '#(?P[0-9]+)', + url_format_string: 'https://trac.example.com/ticket/%(id)s' }); casper.click('form.admin-filter-form input.btn'); }); @@ -202,8 +202,8 @@ casper.waitWhileSelector('.filter_row', function () { casper.waitForSelector('.admin-filter-form', function () { casper.fill('form.admin-filter-form', { - 'pattern': 'a$', - 'url_format_string': 'https://trac.example.com/ticket/%(id)s' + pattern: 'a$', + url_format_string: 'https://trac.example.com/ticket/%(id)s' }); casper.click('form.admin-filter-form input.btn'); }); diff --git a/frontend_tests/node_tests/dict.js b/frontend_tests/node_tests/dict.js index 691842b6a9..fb53515274 100644 --- a/frontend_tests/node_tests/dict.js +++ b/frontend_tests/node_tests/dict.js @@ -118,7 +118,7 @@ set_global('blueslip', {}); caught = undefined; try { - Dict.from_array({'bogus': true}); + Dict.from_array({bogus: true}); } catch (e2) { caught = true; assert.equal(e2.toString(), 'TypeError: Argument is not an array'); diff --git a/frontend_tests/node_tests/dispatch.js b/frontend_tests/node_tests/dispatch.js index eb24eead38..bfa1d9f8a2 100644 --- a/frontend_tests/node_tests/dispatch.js +++ b/frontend_tests/node_tests/dispatch.js @@ -171,8 +171,8 @@ var event_fixtures = { op: 'update_dict', property: 'default', data: { - 'allow_message_editing': true, - 'message_content_edit_limit_seconds': 5 + allow_message_editing: true, + message_content_edit_limit_seconds: 5 } }, @@ -207,7 +207,7 @@ var event_fixtures = { realm_emoji: { type: 'realm_emoji', realm_emoji: { - 'airplane': { + airplane: { display_url: 'some_url' } } diff --git a/frontend_tests/node_tests/i18n.js b/frontend_tests/node_tests/i18n.js index 2cbd1ca2e6..ab5b59f0f2 100644 --- a/frontend_tests/node_tests/i18n.js +++ b/frontend_tests/node_tests/i18n.js @@ -16,7 +16,7 @@ i18n.init({ resources: { fr: { translation: { - 'Reply': "French", + Reply: "French", "You'll receive notifications when a message arrives and __page_params.product_name__ isn't in focus or the message is offscreen.": "Some French text with __page_params.product_name__" } } @@ -32,16 +32,16 @@ var _ = global._; (function test_t_tag() { var args = { - "message": { + message: { is_stream: true, id: "99", stream: "devel", subject: "testing", sender_full_name: "King Lear" }, - "can_edit_message": true, - "can_mute_topic": true, - "narrowed": true + can_edit_message: true, + can_mute_topic: true, + narrowed: true }; var html = '
'; @@ -54,24 +54,24 @@ var _ = global._; (function test_tr_tag() { var args = { - "page_params": { - "fullname": "John Doe", - "product_name": "Zulip", - "password_auth_enabled": false, - "avatar_url": "http://example.com", - "left_side_userlist": false, - "twenty_four_hour_time": false, - "stream_desktop_notifications_enabled": false, - "stream_sounds_enabled": false, - "desktop_notifications_enabled": false, - "sounds_enabled": false, - "enable_offline_email_notifications": false, - "enable_offline_push_notifications": false, - "enable_online_push_notifications": false, - "enable_digest_emails": false, - "domain": "zulip.com", - "autoscroll_forever": false, - "default_desktop_notifications": false + page_params: { + fullname: "John Doe", + product_name: "Zulip", + password_auth_enabled: false, + avatar_url: "http://example.com", + left_side_userlist: false, + twenty_four_hour_time: false, + stream_desktop_notifications_enabled: false, + stream_sounds_enabled: false, + desktop_notifications_enabled: false, + sounds_enabled: false, + enable_offline_email_notifications: false, + enable_offline_push_notifications: false, + enable_online_push_notifications: false, + enable_digest_emails: false, + domain: "zulip.com", + autoscroll_forever: false, + default_desktop_notifications: false } }; diff --git a/frontend_tests/node_tests/search_suggestion.js b/frontend_tests/node_tests/search_suggestion.js index bc4ec9fadf..ebf886d279 100644 --- a/frontend_tests/node_tests/search_suggestion.js +++ b/frontend_tests/node_tests/search_suggestion.js @@ -249,10 +249,10 @@ global.stream_data.populate_stream_topics_for_tests({}); }; global.stream_data.populate_stream_topics_for_tests({ - 'devel': [ + devel: [ {subject: 'REXX'} ], - 'office': [ + office: [ {subject: 'team'}, {subject: 'ignore'}, {subject: 'test'} diff --git a/frontend_tests/node_tests/templates.js b/frontend_tests/node_tests/templates.js index 82543a39c2..869906dcac 100644 --- a/frontend_tests/node_tests/templates.js +++ b/frontend_tests/node_tests/templates.js @@ -73,16 +73,16 @@ function render(template_name, args) { (function actions_popover_content() { var args = { - "message": { + message: { is_stream: true, id: "99", stream: "devel", subject: "testing", sender_full_name: "King Lear" }, - "can_edit_message": true, - "can_mute_topic": true, - "narrowed": true + can_edit_message: true, + can_mute_topic: true, + narrowed: true }; var html = '
'; @@ -109,9 +109,9 @@ function render(template_name, args) { (function admin_emoji_list() { var args = { emoji: { - "name": "MouseFace", - "display_url": "http://emojipedia-us.s3.amazonaws.com/cache/46/7f/467fe69069c408e07517621f263ea9b5.png", - "source_url": "http://emojipedia-us.s3.amazonaws.com/cache/46/7f/467fe69069c408e07517621f263ea9b5.png" + name: "MouseFace", + display_url: "http://emojipedia-us.s3.amazonaws.com/cache/46/7f/467fe69069c408e07517621f263ea9b5.png", + source_url: "http://emojipedia-us.s3.amazonaws.com/cache/46/7f/467fe69069c408e07517621f263ea9b5.png" } }; @@ -132,8 +132,8 @@ function render(template_name, args) { (function admin_filter_list() { var args = { filter: { - "pattern": "#(?P[0-9]+)", - "url_format_string": "https://trac.example.com/ticket/%(id)s" + pattern: "#(?P[0-9]+)", + url_format_string: "https://trac.example.com/ticket/%(id)s" } }; @@ -183,11 +183,11 @@ function render(template_name, args) { var users = ['alice', 'bob', 'carl']; _.each(users, function (user) { var args = { - "user": { - "is_active": true, - "is_active_human": true, - "email": user + '@zulip.com', - "full_name": user + user: { + is_active: true, + is_active_human: true, + email: user + '@zulip.com', + full_name: user } }; html += render('admin_user_list', args); @@ -241,8 +241,8 @@ function render(template_name, args) { (function admin_auth_methods_list() { var args = { method: { - "method": "Email", - "enabled": false + method: "Email", + enabled: false } }; @@ -296,10 +296,10 @@ function render(template_name, args) { html += '
'; html += '
    '; var args = { - "email": "hamlet@zulip.com", - "api_key": "123456ABCD", - "name": "Hamlet", - "avatar_url": "/hamlet/avatar/url" + email: "hamlet@zulip.com", + api_key: "123456ABCD", + name: "Hamlet", + avatar_url: "/hamlet/avatar/url" }; html += render('bot_avatar_row', args); html += '
'; @@ -338,10 +338,10 @@ function render(template_name, args) { (function compose_notification() { var args = { - "note": "You sent a message to a muted topic.", - "link_text": "Narrow to here", - "link_msg_id": "99", - "link_class": "compose_notification_narrow_by_subject" + note: "You sent a message to a muted topic.", + link_text: "Narrow to here", + link_msg_id: "99", + link_class: "compose_notification_narrow_by_subject" }; var html = '
'; html += render('compose_notification', args); @@ -374,12 +374,12 @@ function render(template_name, args) { (function group_pms() { var args = { - "group_pms": [ + group_pms: [ { - "fraction_present": 0.1, - "emails": "alice@zulip.com,bob@zulip.com", - "short_name": "Alice and Bob", - "name": "Alice and Bob" + fraction_present: 0.1, + emails: "alice@zulip.com,bob@zulip.com", + short_name: "Alice and Bob", + name: "Alice and Bob" } ] }; @@ -437,9 +437,9 @@ function render(template_name, args) { (function message_edit_form() { var args = { - "topic": "lunch", - "content": "Let's go to lunch!", - "is_stream": true + topic: "lunch", + content: "Let's go to lunch!", + is_stream: true }; var html = render('message_edit_form', args); global.write_handlebars_output("message_edit_form", html); @@ -557,9 +557,9 @@ function render(template_name, args) { (function notification() { var args = { - "content": "Hello", - "gravatar_url": "/gravatar/url", - "title": "You have a notification" + content: "Hello", + gravatar_url: "/gravatar/url", + title: "You have a notification" }; var html = render('notification', args); @@ -837,19 +837,19 @@ function render(template_name, args) { var args = { users: [ { - "my_fullname": true, - "type_desc": "Active", - "type": "active", - "num_unread": 0, - "email": "lear@zulip.com", - "name": "King Lear" + my_fullname: true, + type_desc: "Active", + type: "active", + num_unread: 0, + email: "lear@zulip.com", + name: "King Lear" }, { - "type_desc": "Away", - "type": "away", - "num_unread": 5, - "email": "othello@zulip.com", - "name": "Othello" + type_desc: "Away", + type: "away", + num_unread: 5, + email: "othello@zulip.com", + name: "Othello" } ] }; diff --git a/frontend_tests/node_tests/topic_list.js b/frontend_tests/node_tests/topic_list.js index 9561c00de1..9e99669d54 100644 --- a/frontend_tests/node_tests/topic_list.js +++ b/frontend_tests/node_tests/topic_list.js @@ -25,7 +25,7 @@ global.compile_template('topic_list_item'); var topics = [ {subject: "coding"} ]; - global.stream_data.populate_stream_topics_for_tests({"devel": topics}); + global.stream_data.populate_stream_topics_for_tests({devel: topics}); global.unread.num_unread_for_subject = function () { return 1; }; @@ -42,4 +42,3 @@ global.compile_template('topic_list_item'); global.write_test_output("test_topic_list_build_widget", parent_elem.html()); }()); - diff --git a/static/js/activity.js b/static/js/activity.js index 2108834591..789be2f2db 100644 --- a/static/js/activity.js +++ b/static/js/activity.js @@ -399,7 +399,7 @@ function status_from_timestamp(baseline_time, presence) { } break; default: - blueslip.error('Unexpected status', {'presence_object': device_presence, 'device': device}, undefined); + blueslip.error('Unexpected status', {presence_object: device_presence, device: device}, undefined); } } }); @@ -531,7 +531,7 @@ function maybe_select_person (e) { // undefined if there are no results var email = people.get_person_from_user_id(topPerson).email; compose.start('private', - {trigger: 'sidebar enter key', "private_message_recipient": email}); + {trigger: 'sidebar enter key', private_message_recipient: email}); } // Clear the user filter exports.escape_search(); diff --git a/static/js/admin.js b/static/js/admin.js index 2dc3b6f07c..75190c76e1 100644 --- a/static/js/admin.js +++ b/static/js/admin.js @@ -378,7 +378,7 @@ function _setup_page() { var stream_name = row.find('.default_stream_name').text(); channel.del({ - url: '/json/default_streams'+ '?' + $.param({"stream_name": stream_name}), + url: '/json/default_streams'+ '?' + $.param({stream_name: stream_name}), error: function (xhr, error_type) { if (xhr.status.toString().charAt(0) === "4") { $(".active_default_stream_row button").closest("td").html( @@ -567,7 +567,7 @@ function _setup_page() { } if (response_data.restricted_to_domain !== undefined) { if (response_data.restricted_to_domain) { - ui.report_success(i18n.t("New users must have e-mails ending in __atdomains_string__!", {'atdomains_string': atdomains_string}), restricted_to_domain_status); + ui.report_success(i18n.t("New users must have e-mails ending in __atdomains_string__!", {atdomains_string: atdomains_string}), restricted_to_domain_status); } else { ui.report_success(i18n.t("New users may have arbitrary e-mails!"), restricted_to_domain_status); } @@ -605,8 +605,10 @@ function _setup_page() { Math.ceil(response_data.message_content_edit_limit_seconds / 60); if (response_data.allow_message_editing) { if (response_data.message_content_edit_limit_seconds > 0) { - ui.report_success(i18n.t("Users can now edit topics for all their messages, and the content of messages which are less than __num_minutes__ minutes old.", - {'num_minutes' : data_message_content_edit_limit_minutes}), + ui.report_success(i18n.t("Users can now edit topics for all their messages," + +" and the content of messages which are less than __num_minutes__ minutes old.", + {num_minutes : + data_message_content_edit_limit_minutes}), message_editing_status); } else { ui.report_success(i18n.t("Users can now edit the content and topics of all their past messages!"), message_editing_status); diff --git a/static/js/alert_words_ui.js b/static/js/alert_words_ui.js index 407de29cb8..8087191c81 100644 --- a/static/js/alert_words_ui.js +++ b/static/js/alert_words_ui.js @@ -20,12 +20,12 @@ function add_alert_word(word, event) { $("#empty_alert_word_error").show(); return; } - var final_li = templates.render('alert_word_settings_item', {'word': word, editing: false}); + var final_li = templates.render('alert_word_settings_item', {word: word, editing: false}); var li = $(event.target).parents('li'); li.replaceWith(final_li); - var new_word = templates.render('alert_word_settings_item', {'word': '', editing: true}); + var new_word = templates.render('alert_word_settings_item', {word: '', editing: true}); var word_list = $('#alert_words_list'); word_list.append(new_word); @@ -41,10 +41,10 @@ exports.set_up_alert_words = function () { var word_list = $('#alert_words_list'); _.each(alert_words.words, function (word) { - var li = templates.render('alert_word_settings_item', {'word': word}); + var li = templates.render('alert_word_settings_item', {word: word}); word_list.append(li); }); - var new_word = templates.render('alert_word_settings_item', {'word': '', editing: true}); + var new_word = templates.render('alert_word_settings_item', {word: '', editing: true}); word_list.append(new_word); $('#alert_words_list').on('click', '#create_alert_word_button', function (event) { diff --git a/static/js/click_handlers.js b/static/js/click_handlers.js index 7a1029ab90..fc0dcd7df2 100644 --- a/static/js/click_handlers.js +++ b/static/js/click_handlers.js @@ -317,14 +317,14 @@ $(function () { // Keep these 2 feedback bot triggers separate because they have to // propagate the event differently. $('.feedback').click(function (e) { - compose.start('private', { 'private_message_recipient': 'feedback@zulip.com', + compose.start('private', { private_message_recipient: 'feedback@zulip.com', trigger: 'feedback menu item' }); }); $('#feedback_button').click(function (e) { e.stopPropagation(); popovers.hide_all(); - compose.start('private', { 'private_message_recipient': 'feedback@zulip.com', + compose.start('private', { private_message_recipient: 'feedback@zulip.com', trigger: 'feedback button' }); }); diff --git a/static/js/compose.js b/static/js/compose.js index 62be7232f2..66ce418d67 100644 --- a/static/js/compose.js +++ b/static/js/compose.js @@ -428,10 +428,10 @@ function send_message_ajax(request, success, error) { } function report_send_time(send_time, receive_time, display_time, locally_echoed, rendered_changed) { - var data = {"time": send_time.toString(), - "received": receive_time.toString(), - "displayed": display_time.toString(), - "locally_echoed": locally_echoed}; + var data = {time: send_time.toString(), + received: receive_time.toString(), + displayed: display_time.toString(), + locally_echoed: locally_echoed}; if (locally_echoed) { data.rendered_content_disparity = rendered_changed; } @@ -642,10 +642,10 @@ exports.respond_to_message = function (opts) { } else { msg_type = message.type; } - compose.start(msg_type, {'stream': stream, 'subject': subject, - 'private_message_recipient': pm_recipient, - 'replying_to_message': message, - 'trigger': opts.trigger}); + compose.start(msg_type, {stream: stream, subject: subject, + private_message_recipient: pm_recipient, + replying_to_message: message, + trigger: opts.trigger}); }; @@ -729,7 +729,7 @@ exports.has_message_content = function () { // *Synchronously* check if a stream exists. exports.check_stream_existence = function (stream_name, autosubscribe) { var result = "error"; - var request = {'stream': stream_name}; + var request = {stream: stream_name}; if (autosubscribe) { request.autosubscribe = true; } @@ -856,11 +856,11 @@ function validate_private_message() { invalid_recipients.push(email); }); if (invalid_recipients.length === 1) { - context = {'recipient': invalid_recipients.join()}; + context = {recipient: invalid_recipients.join()}; compose_error(i18n.t("The recipient __recipient__ is not valid ", context), $("#private_message_recipient")); return false; } else if (invalid_recipients.length > 1) { - context = {'recipients': invalid_recipients.join()}; + context = {recipients: invalid_recipients.join()}; compose_error(i18n.t("The recipients __recipients__ are not valid ", context), $("#private_message_recipient")); return false; } diff --git a/static/js/composebox_typeahead.js b/static/js/composebox_typeahead.js index ae8901b262..b31fb86056 100644 --- a/static/js/composebox_typeahead.js +++ b/static/js/composebox_typeahead.js @@ -368,7 +368,7 @@ exports.initialize = function () { return channel.post({ url: '/json/users/me/enter-sends', idempotent: true, - data: {'enter_sends': page_params.enter_sends} + data: {enter_sends: page_params.enter_sends} }); }); $("#enter_sends").prop('checked', page_params.enter_sends); diff --git a/static/js/copy_and_paste.js b/static/js/copy_and_paste.js index f1a07a2322..467f7aaac8 100644 --- a/static/js/copy_and_paste.js +++ b/static/js/copy_and_paste.js @@ -123,7 +123,7 @@ function copy_handler(e) { // Select div so that the browser will copy it // instead of copying the original selection - div.css({position: 'absolute', 'left': '-99999px'}) + div.css({position: 'absolute', left: '-99999px'}) .attr('id', 'copytempdiv'); $('body').append(div); selection.selectAllChildren(div[0]); diff --git a/static/js/custom_markdown.js b/static/js/custom_markdown.js index 7e9c7e53d5..612b80b091 100644 --- a/static/js/custom_markdown.js +++ b/static/js/custom_markdown.js @@ -13,14 +13,14 @@ var exports = {}; channel.post({ url: '/json/users/me/subscriptions', data: { - subscriptions: JSON.stringify([{'name': stream_name}]) + subscriptions: JSON.stringify([{name: stream_name}]) } }).then( function (data) { if (!$.isEmptyObject(data.already_subscribed)) { // Display the canonical stream capitalization. var true_stream_name = data.already_subscribed[page_params.email][0]; - ui.report_success(i18n.t("Already subscribed to __stream__", {'stream': true_stream_name}), + ui.report_success(i18n.t("Already subscribed to __stream__", {stream: true_stream_name}), $status_message); } }, function (xhr) { @@ -45,13 +45,13 @@ var exports = {}; } function display_subscribe($button, stream_name) { - $button.text(i18n.t('Subscribe to __stream__', {'stream': stream_data.canonicalized_name(stream_name)})) + $button.text(i18n.t('Subscribe to __stream__', {stream: stream_data.canonicalized_name(stream_name)})) .removeClass('btn-success') .addClass('btn-default'); } function display_unsubscribe($button, stream_name) { - $button.text(i18n.t('Unsubscribe from __stream__', {'stream': stream_data.canonicalized_name(stream_name)})) + $button.text(i18n.t('Unsubscribe from __stream__', {stream: stream_data.canonicalized_name(stream_name)})) .removeClass('btn-default') .addClass('btn-success'); } diff --git a/static/js/filter.js b/static/js/filter.js index d3f232241c..69c7a46729 100644 --- a/static/js/filter.js +++ b/static/js/filter.js @@ -118,7 +118,7 @@ function Filter(operators) { } } -var canonical_operators = {"from": "sender", "subject": "topic"}; +var canonical_operators = {from: "sender", subject: "topic"}; Filter.canonicalize_operator = function (operator) { operator = operator.toLowerCase(); diff --git a/static/js/invite.js b/static/js/invite.js index c5d91d9f07..3351b8549a 100644 --- a/static/js/invite.js +++ b/static/js/invite.js @@ -65,7 +65,7 @@ exports.initialize = function () { }, success: function (resp, statusText, xhr, form) { $('#submit-invitation').button('reset'); - invite_status.text(i18n.t('User invited successfully.', {'count': (invitee_emails.val().match(/@/g) || [] ).length})) + invite_status.text(i18n.t('User invited successfully.', {count: (invitee_emails.val().match(/@/g) || [] ).length})) .addClass('alert-success') .show(); invitee_emails.val(''); diff --git a/static/js/message_edit.js b/static/js/message_edit.js index e84a05fe00..daf413c9c5 100644 --- a/static/js/message_edit.js +++ b/static/js/message_edit.js @@ -143,11 +143,11 @@ function timer_text(seconds_left) { var minutes = Math.floor(seconds_left / 60); var seconds = seconds_left % 60; if (minutes >= 1) { - return i18n.t("__minutes__ min to edit", {'minutes': minutes.toString()}); + return i18n.t("__minutes__ min to edit", {minutes: minutes.toString()}); } else if (seconds_left >= 10) { - return i18n.t("__seconds__ sec to edit", {'seconds': (seconds - seconds % 5).toString()}); + return i18n.t("__seconds__ sec to edit", {seconds: (seconds - seconds % 5).toString()}); } - return i18n.t("__seconds__ sec to edit", {'seconds': seconds.toString()}); + return i18n.t("__seconds__ sec to edit", {seconds: seconds.toString()}); } function edit_message (row, raw_content) { diff --git a/static/js/message_store.js b/static/js/message_store.js index 24f3a2f630..14f53212fb 100644 --- a/static/js/message_store.js +++ b/static/js/message_store.js @@ -120,9 +120,9 @@ function add_message_metadata(message) { stream_data.process_message_for_recent_topics(message); - involved_people = [{'full_name': message.sender_full_name, - 'user_id': message.sender_id, - 'email': message.sender_email}]; + involved_people = [{full_name: message.sender_full_name, + user_id: message.sender_id, + email: message.sender_email}]; set_topic_edit_properties(message); break; @@ -592,8 +592,8 @@ util.execute_early(function () { // backfill more messages after the user is idle var backfill_batch_size = 1000; - $(document).idle({'idle': 1000*10, - 'onIdle': function () { + $(document).idle({idle: 1000*10, + onIdle: function () { var first_id = message_list.all.first().id; exports.load_old_messages({ anchor: first_id, diff --git a/static/js/narrow.js b/static/js/narrow.js index d10861b836..525a4ad6ff 100644 --- a/static/js/narrow.js +++ b/static/js/narrow.js @@ -111,9 +111,9 @@ exports.topic = function () { function report_narrow_time(initial_core_time, initial_free_time, network_time) { channel.post({ url: '/json/report_narrow_time', - data: {"initial_core": initial_core_time.toString(), - "initial_free": initial_free_time.toString(), - "network": network_time.toString()} + data: {initial_core: initial_core_time.toString(), + initial_free: initial_free_time.toString(), + network: network_time.toString()} }); } @@ -141,8 +141,8 @@ function report_unnarrow_time() { channel.post({ url: '/json/report_unnarrow_time', - data: {"initial_core": initial_core_time.toString(), - "initial_free": initial_free_time.toString()} + data: {initial_core: initial_core_time.toString(), + initial_free: initial_free_time.toString()} }); unnarrow_times = {}; diff --git a/static/js/people.js b/static/js/people.js index 777e354c28..298e866888 100644 --- a/static/js/people.js +++ b/static/js/people.js @@ -183,8 +183,8 @@ exports.get_rest_of_realm = function get_rest_of_realm() { var people_minus_you = []; realm_people_dict.each(function (person) { if (!util.is_current_user(person.email)) { - people_minus_you.push({"email": person.email, - "full_name": person.full_name}); + people_minus_you.push({email: person.email, + full_name: person.full_name}); } }); return people_minus_you.sort(people_cmp); diff --git a/static/js/popovers.js b/static/js/popovers.js index 788465dba8..8c7ea1f25a 100644 --- a/static/js/popovers.js +++ b/static/js/popovers.js @@ -371,7 +371,7 @@ exports.register_click_handlers = function () { var email = people.get_person_from_user_id(user_id).email; popovers.hide_user_sidebar_popover(); - compose.start('private', {"private_message_recipient": email, trigger: 'sidebar user actions'}); + compose.start('private', {private_message_recipient: email, trigger: 'sidebar user actions'}); e.stopPropagation(); }); @@ -447,10 +447,10 @@ exports.register_click_handlers = function () { var can_unmute_topic = is_muted; var content = templates.render('topic_sidebar_actions', { - 'stream_name': stream_name, - 'topic_name': topic_name, - 'can_mute_topic': can_mute_topic, - 'can_unmute_topic': can_unmute_topic + stream_name: stream_name, + topic_name: topic_name, + can_mute_topic: can_mute_topic, + can_unmute_topic: can_unmute_topic }); $(elt).popover({ @@ -523,7 +523,7 @@ exports.register_click_handlers = function () { var ypos = $(elt).offset().top - viewport.scrollTop(); $(elt).popover({ - content: templates.render('stream_sidebar_actions', {'stream': stream_data.get_sub(stream)}), + content: templates.render('stream_sidebar_actions', {stream: stream_data.get_sub(stream)}), trigger: "manual", fixed: true }); @@ -664,7 +664,7 @@ exports.register_click_handlers = function () { $('body').on('click', '.compose_to_stream', function (e) { var stream = $(e.currentTarget).parents('ul').attr('data-name'); popovers.hide_stream_sidebar_popover(); - compose.start('stream', {"stream": stream, trigger: 'sidebar stream actions'}); + compose.start('stream', {stream: stream, trigger: 'sidebar stream actions'}); e.stopPropagation(); }); diff --git a/static/js/reload.js b/static/js/reload.js index 469fba583a..ee14aa8a61 100644 --- a/static/js/reload.js +++ b/static/js/reload.js @@ -241,29 +241,29 @@ exports.initiate = function (options) { compose_done_handler = function () { idle_control.cancel(); - idle_control = $(document).idle({'idle': home_timeout, - 'onIdle': reload_from_idle}); + idle_control = $(document).idle({idle: home_timeout, + onIdle: reload_from_idle}); $(document).off('compose_canceled.zulip compose_finished.zulip', compose_done_handler); $(document).on('compose_started.zulip', compose_started_handler); }; compose_started_handler = function () { idle_control.cancel(); - idle_control = $(document).idle({'idle': composing_timeout, - 'onIdle': reload_from_idle}); + idle_control = $(document).idle({idle: composing_timeout, + onIdle: reload_from_idle}); $(document).off('compose_started.zulip', compose_started_handler); $(document).on('compose_canceled.zulip compose_finished.zulip', compose_done_handler); }; if (compose.composing()) { - idle_control = $(document).idle({'idle': composing_timeout, - 'onIdle': reload_from_idle}); + idle_control = $(document).idle({idle: composing_timeout, + onIdle: reload_from_idle}); $(document).on('compose_canceled.zulip compose_finished.zulip', compose_done_handler); } else { - idle_control = $(document).idle({'idle': home_timeout, - 'onIdle': reload_from_idle}); + idle_control = $(document).idle({idle: home_timeout, + onIdle: reload_from_idle}); $(document).on('compose_started.zulip', compose_started_handler); } }; diff --git a/static/js/scroll_bar.js b/static/js/scroll_bar.js index c33dd6704c..ceb7d382b2 100644 --- a/static/js/scroll_bar.js +++ b/static/js/scroll_bar.js @@ -35,10 +35,10 @@ $(function () { $(".column-right").css("right", sbWidth + "px"); $(".app-main .right-sidebar").css({"margin-left": (sbWidth) + "px", - "width": (250 - sbWidth) + "px"}); + width: (250 - sbWidth) + "px"}); $("#compose").css("left", "-" + sbWidth + "px"); - $(".compose-content").css({"left": sbWidth + "px", + $(".compose-content").css({left: sbWidth + "px", "margin-right": (250 + sbWidth) + "px"}); $("#compose-container").css("max-width", (1400 + sbWidth) + "px"); diff --git a/static/js/settings.js b/static/js/settings.js index 6715be5ca7..fb4b5a0f53 100644 --- a/static/js/settings.js +++ b/static/js/settings.js @@ -17,7 +17,7 @@ function build_stream_list($select, extra_names) { }; var public_names = _.chain(stream_items) - .where({'invite_only': false}) + .where({invite_only: false}) .pluck('name') .map(function (x) { return [x, x]; }) .value(); @@ -30,7 +30,7 @@ function build_stream_list($select, extra_names) { .value(); var private_options = _.chain(stream_items) - .where({'invite_only': true}) + .where({invite_only: true}) .pluck('name') .map(function (x) { return [x, x]; }) .map(build_option) diff --git a/static/js/socket.js b/static/js/socket.js index a965f8cff8..66420eb71d 100644 --- a/static/js/socket.js +++ b/static/js/socket.js @@ -1,12 +1,12 @@ var Socket = (function () { var CLOSE_REASONS = { - 'none_given': {code: 4000, msg: "No reason provided"}, - 'no_heartbeat': {code: 4001, msg: "Missed too many heartbeats"}, - 'auth_fail': {code: 4002, msg: "Authentication failed"}, - 'ack_timeout': {code: 4003, msg: "ACK timeout"}, - 'cant_send': {code: 4004, msg: "User attempted to send while Socket was not ready"}, - 'unsuspend': {code: 4005, msg: "Got unsuspend event"} + none_given: {code: 4000, msg: "No reason provided"}, + no_heartbeat: {code: 4001, msg: "Missed too many heartbeats"}, + auth_fail: {code: 4002, msg: "Authentication failed"}, + ack_timeout: {code: 4003, msg: "ACK timeout"}, + cant_send: {code: 4004, msg: "User attempted to send while Socket was not ready"}, + unsuspend: {code: 4005, msg: "Got unsuspend event"} }; function Socket(url) { diff --git a/static/js/stream_color.js b/static/js/stream_color.js index 1ed796903e..6c32551cad 100644 --- a/static/js/stream_color.js +++ b/static/js/stream_color.js @@ -49,7 +49,7 @@ function update_table_stream_color(table, stream_name, color) { if ($.trim($label.text()) === stream_name) { 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, + $label.css({background: style, "border-left-color": style}); $label.removeClass(exports.color_classes); $label.addClass(color_class); diff --git a/static/js/stream_data.js b/static/js/stream_data.js index 88799af10e..e16ae2bbea 100644 --- a/static/js/stream_data.js +++ b/static/js/stream_data.js @@ -270,9 +270,9 @@ exports.receives_audible_notifications = function (stream_name) { exports.add_admin_options = function (sub) { return _.extend(sub, { - 'is_admin': page_params.is_admin, - 'can_make_public': page_params.is_admin && sub.invite_only && sub.subscribed, - 'can_make_private': page_params.is_admin && !sub.invite_only + is_admin: page_params.is_admin, + can_make_public: page_params.is_admin && sub.invite_only && sub.subscribed, + can_make_private: page_params.is_admin && !sub.invite_only }); }; diff --git a/static/js/subs.js b/static/js/subs.js index 2b8b2be3e1..bf03230ff7 100644 --- a/static/js/subs.js +++ b/static/js/subs.js @@ -43,7 +43,7 @@ function set_stream_property(stream_name, property, value) { var sub_data = {stream: stream_name, property: property, value: value}; return channel.post({ url: '/json/subscriptions/property', - data: {"subscription_data": JSON.stringify([sub_data])}, + data: {subscription_data: JSON.stringify([sub_data])}, timeout: 10*1000 }); } @@ -247,10 +247,10 @@ function add_email_hint(row, email_address_hint_content) { // Add a popover explaining stream e-mail addresses on hover. var hint_id = "#email-address-hint-" + row.stream_id; var email_address_hint = $(hint_id); - email_address_hint.popover({"placement": "bottom", - "title": "Email integration", - "content": email_address_hint_content, - "trigger": "manual"}); + email_address_hint.popover({placement: "bottom", + title: "Email integration", + content: email_address_hint_content, + trigger: "manual"}); $("body").on("mouseover", hint_id, function (e) { email_address_hint.popover('show'); @@ -598,7 +598,7 @@ function ajaxSubscribe(stream) { return channel.post({ url: "/json/users/me/subscriptions", - data: {"subscriptions": JSON.stringify([{"name": stream}]) }, + data: {subscriptions: JSON.stringify([{name: stream}]) }, success: function (resp, statusText, xhr, form) { $("#create_stream_name").val(""); exports.filter_table({input: ""}); @@ -607,7 +607,7 @@ function ajaxSubscribe(stream) { if (!$.isEmptyObject(res.already_subscribed)) { // Display the canonical stream capitalization. true_stream_name = res.already_subscribed[page_params.email][0]; - ui.report_success(i18n.t("Already subscribed to __stream__", {'stream': true_stream_name}), + ui.report_success(i18n.t("Already subscribed to __stream__", {stream: true_stream_name}), $("#subscriptions-status"), 'subscriptions-status'); } // The rest of the work is done via the subscribe event we will get @@ -622,7 +622,7 @@ function ajaxSubscribe(stream) { function ajaxUnsubscribe(stream) { return channel.post({ url: "/json/subscriptions/remove", - data: {"subscriptions": JSON.stringify([stream]) }, + data: {subscriptions: JSON.stringify([stream]) }, success: function (resp, statusText, xhr, form) { var name; var res = JSON.parse(xhr.responseText); @@ -644,10 +644,10 @@ function ajaxSubscribeForCreation(stream, description, principals, invite_only, // Subscribe yourself and possible other people to a new stream. return channel.post({ url: "/json/users/me/subscriptions", - data: {"subscriptions": JSON.stringify([{"name": stream, "description": description}]), - "principals": JSON.stringify(principals), - "invite_only": JSON.stringify(invite_only), - "announce": JSON.stringify(announce) + data: {subscriptions: JSON.stringify([{name: stream, description: description}]), + principals: JSON.stringify(principals), + invite_only: JSON.stringify(invite_only), + announce: JSON.stringify(announce) }, success: function (data) { $("#create_stream_name").val(""); @@ -702,8 +702,8 @@ function show_new_stream_modal() { exports.invite_user_to_stream = function (user_email, stream_name, success, failure) { return channel.post({ url: "/json/users/me/subscriptions", - data: {"subscriptions": JSON.stringify([{"name": stream_name}]), - "principals": JSON.stringify([user_email])}, + data: {subscriptions: JSON.stringify([{name: stream_name}]), + principals: JSON.stringify([user_email])}, success: success, error: failure }); @@ -712,8 +712,8 @@ exports.invite_user_to_stream = function (user_email, stream_name, success, fail exports.remove_user_from_stream = function (user_email, stream_name, success, failure) { return channel.post({ url: "/json/subscriptions/remove", - data: {"subscriptions": JSON.stringify([stream_name]), - "principals": JSON.stringify([user_email])}, + data: {subscriptions: JSON.stringify([stream_name]), + principals: JSON.stringify([user_email])}, success: success, error: failure }); @@ -779,7 +779,7 @@ $(function () { // Hide users which aren't in filtered users _.each(users, function (user) { var display_type = filtered_users.hasOwnProperty(user.email)? "block" : "none"; - $("label[data-name='" + user.email + "']").css({"display":display_type}); + $("label[data-name='" + user.email + "']").css({display:display_type}); }); update_announce_stream_state(); @@ -787,9 +787,9 @@ $(function () { }); var announce_stream_docs = $("#announce-stream-docs"); - announce_stream_docs.popover({"placement": "right", - "content": templates.render('announce_stream_docs'), - "trigger": "manual"}); + announce_stream_docs.popover({placement: "right", + content: templates.render('announce_stream_docs'), + trigger: "manual"}); $("body").on("mouseover", "#announce-stream-docs", function (e) { announce_stream_docs.popover('show'); announce_stream_docs.data('popover').tip().css('z-index', 2000); @@ -1021,7 +1021,7 @@ $(function () { channel.patch({ // Stream names might contain unsafe characters so we must encode it first. url: "/json/streams/" + encodeURIComponent(sub.name), - data: {"new_name": JSON.stringify(new_name)}, + data: {new_name: JSON.stringify(new_name)}, success: function (data) { new_name_box.val(''); ui.report_success(i18n.t("The stream has been renamed!"), $("#subscriptions-status "), @@ -1048,7 +1048,7 @@ $(function () { // Stream names might contain unsafe characters so we must encode it first. url: '/json/streams/' + encodeURIComponent(stream_name), data: { - 'description': JSON.stringify(description) + description: JSON.stringify(description) }, success: function () { // The event from the server will update the rest of the UI @@ -1093,7 +1093,7 @@ $(function () { var sub = stream_data.get_sub_by_id(stream_id); $("#subscriptions-status").hide(); - var data = {"stream_name": sub.name}; + var data = {stream_name: sub.name}; channel.post({ url: url, diff --git a/static/js/tutorial.js b/static/js/tutorial.js index 0fe6dc7bad..e31a2e2fe4 100644 --- a/static/js/tutorial.js +++ b/static/js/tutorial.js @@ -188,10 +188,10 @@ var fake_messages = [ ]; function send_delayed_stream_message(stream, topic, content, delay) { - var data = {'type': JSON.stringify('stream'), - 'recipient': JSON.stringify(stream), - 'topic': JSON.stringify(topic), - 'content': JSON.stringify(content)}; + var data = {type: JSON.stringify('stream'), + recipient: JSON.stringify(stream), + topic: JSON.stringify(topic), + content: JSON.stringify(content)}; setTimeout(function () { $.ajax({ dataType: 'json', @@ -203,7 +203,7 @@ function send_delayed_stream_message(stream, topic, content, delay) { } function disable_event_handlers() { - $('body').css({'overflow':'hidden'}); // prevents scrolling the feed + $('body').css({overflow:'hidden'}); // prevents scrolling the feed _.each(["keydown", "keyup", "keypress", "scroll"], function (event_name) { var existing_events = $._data(document, "events")[event_name]; if (existing_events === undefined) { @@ -215,7 +215,7 @@ function disable_event_handlers() { } function enable_event_handlers() { - $('body').css({'overflow':'auto'}); // enables scrolling the feed + $('body').css({overflow:'auto'}); // enables scrolling the feed _.each(["keydown", "keyup", "keypress", "scroll"], function (event_name) { $._data(document, "events")[event_name] = event_handlers[event_name]; }); diff --git a/static/js/unread.js b/static/js/unread.js index c717e26e2d..b0198d938c 100644 --- a/static/js/unread.js +++ b/static/js/unread.js @@ -329,7 +329,7 @@ function consider_bankruptcy() { if ((page_params.unread_count > 500) && (now - page_params.furthest_read_time > 60 * 60 * 24 * 2)) { // 2 days. var unread_info = templates.render('bankruptcy_modal', - {"unread_count": page_params.unread_count}); + {unread_count: page_params.unread_count}); $('#bankruptcy-unread-count').html(unread_info); $('#bankruptcy').modal('show'); } else {