mirror of https://github.com/zulip/zulip.git
eslint: Add key-spacing linter rule.
Apparently, we didn't have one of these, and thus had a moderate number of generally very old violations in the codebase. Fix this and clear the ones that exist..
This commit is contained in:
parent
392175d6e8
commit
bdb3da4504
|
@ -245,6 +245,12 @@
|
||||||
"FunctionExpression": {"parameters": "first"},
|
"FunctionExpression": {"parameters": "first"},
|
||||||
"FunctionDeclaration": {"parameters": "first"}
|
"FunctionDeclaration": {"parameters": "first"}
|
||||||
}],
|
}],
|
||||||
|
"key-spacing": [ "error",
|
||||||
|
{
|
||||||
|
"beforeColon": false,
|
||||||
|
"afterColon": true
|
||||||
|
}
|
||||||
|
],
|
||||||
"keyword-spacing": [ "error",
|
"keyword-spacing": [ "error",
|
||||||
{
|
{
|
||||||
"before": true,
|
"before": true,
|
||||||
|
|
|
@ -169,7 +169,7 @@ exports.select_item_via_typeahead = function (field_selector, str, item) {
|
||||||
currentTarget: $('.typeahead:visible li:contains("' + item + '")')[0],
|
currentTarget: $('.typeahead:visible li:contains("' + item + '")')[0],
|
||||||
});
|
});
|
||||||
tah.select();
|
tah.select();
|
||||||
}, {field_selector:field_selector, str: str, item: item});
|
}, {field_selector: field_selector, str: str, item: item});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -29,23 +29,23 @@ casper.then(function () {
|
||||||
// Send some messages.
|
// Send some messages.
|
||||||
|
|
||||||
common.then_send_many([
|
common.then_send_many([
|
||||||
{ stream: 'Verona', subject: 'frontend test',
|
{ stream: 'Verona', subject: 'frontend test',
|
||||||
content: 'test verona A' },
|
content: 'test verona A' },
|
||||||
|
|
||||||
{ stream: 'Verona', subject: 'frontend test',
|
{ stream: 'Verona', subject: 'frontend test',
|
||||||
content: 'test verona B' },
|
content: 'test verona B' },
|
||||||
|
|
||||||
{ stream: 'Verona', subject: 'other subject',
|
{ stream: 'Verona', subject: 'other subject',
|
||||||
content: 'test verona C' },
|
content: 'test verona C' },
|
||||||
|
|
||||||
{ recipient: 'cordelia@zulip.com, hamlet@zulip.com',
|
{ recipient: 'cordelia@zulip.com, hamlet@zulip.com',
|
||||||
content: 'personal A' },
|
content: 'personal A' },
|
||||||
|
|
||||||
{ recipient: 'cordelia@zulip.com, hamlet@zulip.com',
|
{ recipient: 'cordelia@zulip.com, hamlet@zulip.com',
|
||||||
content: 'personal B' },
|
content: 'personal B' },
|
||||||
|
|
||||||
{ recipient: 'cordelia@zulip.com',
|
{ recipient: 'cordelia@zulip.com',
|
||||||
content: 'personal C' }]);
|
content: 'personal C' }]);
|
||||||
|
|
||||||
common.wait_for_receive(function () {
|
common.wait_for_receive(function () {
|
||||||
common.expected_messages('zhome', [
|
common.expected_messages('zhome', [
|
||||||
|
@ -66,11 +66,11 @@ common.wait_for_receive(function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
common.then_send_many([
|
common.then_send_many([
|
||||||
{ stream: 'Verona', subject: 'frontend test',
|
{ stream: 'Verona', subject: 'frontend test',
|
||||||
content: 'test verona D' },
|
content: 'test verona D' },
|
||||||
|
|
||||||
{ recipient: 'cordelia@zulip.com, hamlet@zulip.com',
|
{ recipient: 'cordelia@zulip.com, hamlet@zulip.com',
|
||||||
content: 'personal D' },
|
content: 'personal D' },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
common.then_log_out();
|
common.then_log_out();
|
||||||
|
|
|
@ -11,35 +11,35 @@ casper.then(function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
common.then_send_many([
|
common.then_send_many([
|
||||||
{ stream: 'Verona', subject: 'frontend test',
|
{ stream: 'Verona', subject: 'frontend test',
|
||||||
content: 'test message A' },
|
content: 'test message A' },
|
||||||
|
|
||||||
{ stream: 'Verona', subject: 'frontend test',
|
{ stream: 'Verona', subject: 'frontend test',
|
||||||
content: 'test message B' },
|
content: 'test message B' },
|
||||||
|
|
||||||
{ stream: 'Verona', subject: 'other subject',
|
{ stream: 'Verona', subject: 'other subject',
|
||||||
content: 'test message C' },
|
content: 'test message C' },
|
||||||
|
|
||||||
{ stream: 'Denmark', subject: 'frontend test',
|
{ stream: 'Denmark', subject: 'frontend test',
|
||||||
content: 'other message' },
|
content: 'other message' },
|
||||||
|
|
||||||
{ recipient: 'cordelia@zulip.com, hamlet@zulip.com',
|
{ recipient: 'cordelia@zulip.com, hamlet@zulip.com',
|
||||||
content: 'personal A' },
|
content: 'personal A' },
|
||||||
|
|
||||||
{ recipient: 'cordelia@zulip.com, hamlet@zulip.com',
|
{ recipient: 'cordelia@zulip.com, hamlet@zulip.com',
|
||||||
content: 'personal B' },
|
content: 'personal B' },
|
||||||
|
|
||||||
{ recipient: 'cordelia@zulip.com',
|
{ recipient: 'cordelia@zulip.com',
|
||||||
content: 'personal C' },
|
content: 'personal C' },
|
||||||
|
|
||||||
{ stream: 'Verona', subject: 'frontend test',
|
{ stream: 'Verona', subject: 'frontend test',
|
||||||
content: 'test message D' },
|
content: 'test message D' },
|
||||||
|
|
||||||
{ recipient: 'cordelia@zulip.com, hamlet@zulip.com',
|
{ recipient: 'cordelia@zulip.com, hamlet@zulip.com',
|
||||||
content: 'personal D' },
|
content: 'personal D' },
|
||||||
|
|
||||||
{ recipient: 'cordelia@zulip.com',
|
{ recipient: 'cordelia@zulip.com',
|
||||||
content: 'personal E' },
|
content: 'personal E' },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -163,7 +163,7 @@ casper.then(function () {
|
||||||
casper.waitWhileVisible('.message_comp');
|
casper.waitWhileVisible('.message_comp');
|
||||||
common.then_send_many([
|
common.then_send_many([
|
||||||
{ recipient: recipients.join(','),
|
{ recipient: recipients.join(','),
|
||||||
content: 'A huddle to check spaces' }]);
|
content: 'A huddle to check spaces' }]);
|
||||||
|
|
||||||
casper.then(function () {
|
casper.then(function () {
|
||||||
common.keypress(27); // escape to dismiss compose box
|
common.keypress(27); // escape to dismiss compose box
|
||||||
|
|
|
@ -68,7 +68,7 @@ casper.then(function () {
|
||||||
|
|
||||||
casper.then(function () {
|
casper.then(function () {
|
||||||
casper.waitUntilVisible('#get_api_key_button', function () {
|
casper.waitUntilVisible('#get_api_key_button', function () {
|
||||||
casper.fill('#get_api_key_form', {password:test_credentials.default_user.password});
|
casper.fill('#get_api_key_form', {password: test_credentials.default_user.password});
|
||||||
casper.click('#get_api_key_button');
|
casper.click('#get_api_key_button');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -19,7 +19,7 @@ casper.then(function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
common.then_send_message('stream', {
|
common.then_send_message('stream', {
|
||||||
stream: 'Verona',
|
stream: 'Verona',
|
||||||
subject: 'stars',
|
subject: 'stars',
|
||||||
content: 'test star',
|
content: 'test star',
|
||||||
});
|
});
|
||||||
|
|
|
@ -18,7 +18,7 @@ function then_edit_last_message() {
|
||||||
// Send and edit a stream message
|
// Send and edit a stream message
|
||||||
|
|
||||||
common.then_send_message('stream', {
|
common.then_send_message('stream', {
|
||||||
stream: 'Verona',
|
stream: 'Verona',
|
||||||
subject: 'edits',
|
subject: 'edits',
|
||||||
content: 'test editing',
|
content: 'test editing',
|
||||||
});
|
});
|
||||||
|
@ -45,7 +45,7 @@ casper.waitWhileVisible("textarea.message_edit_content", function () {
|
||||||
});
|
});
|
||||||
|
|
||||||
common.then_send_message('stream', {
|
common.then_send_message('stream', {
|
||||||
stream: 'Verona',
|
stream: 'Verona',
|
||||||
subject: 'edits',
|
subject: 'edits',
|
||||||
content: '/me test editing one line with me',
|
content: '/me test editing one line with me',
|
||||||
});
|
});
|
||||||
|
|
|
@ -9,7 +9,7 @@ casper.waitUntilVisible('#zhome', function () {
|
||||||
|
|
||||||
casper.then(function () {
|
casper.then(function () {
|
||||||
casper.fill('form[action^="/json/messages"]', {
|
casper.fill('form[action^="/json/messages"]', {
|
||||||
stream_message_recipient_stream: 'Verona',
|
stream_message_recipient_stream: 'Verona',
|
||||||
stream_message_recipient_topic: 'Test mention all',
|
stream_message_recipient_topic: 'Test mention all',
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -15,12 +15,12 @@ var content2 = 'admin: edit test message 2';
|
||||||
|
|
||||||
// send two messages
|
// send two messages
|
||||||
common.then_send_message('stream', {
|
common.then_send_message('stream', {
|
||||||
stream: 'Verona',
|
stream: 'Verona',
|
||||||
subject: 'edits',
|
subject: 'edits',
|
||||||
content: content1,
|
content: content1,
|
||||||
});
|
});
|
||||||
common.then_send_message('stream', {
|
common.then_send_message('stream', {
|
||||||
stream: 'Verona',
|
stream: 'Verona',
|
||||||
subject: 'edits',
|
subject: 'edits',
|
||||||
content: content2,
|
content: content2,
|
||||||
});
|
});
|
||||||
|
|
|
@ -8,25 +8,25 @@ casper.then(function () {
|
||||||
|
|
||||||
// setup environment: several messages to different topics
|
// setup environment: several messages to different topics
|
||||||
common.then_send_many([
|
common.then_send_many([
|
||||||
{ stream: 'Verona', subject: 'copy-paste-subject #1',
|
{ stream: 'Verona', subject: 'copy-paste-subject #1',
|
||||||
content: 'copy paste test A' },
|
content: 'copy paste test A' },
|
||||||
|
|
||||||
{ stream: 'Verona', subject: 'copy-paste-subject #1',
|
{ stream: 'Verona', subject: 'copy-paste-subject #1',
|
||||||
content: 'copy paste test B' },
|
content: 'copy paste test B' },
|
||||||
|
|
||||||
{ stream: 'Verona', subject: 'copy-paste-subject #2',
|
{ stream: 'Verona', subject: 'copy-paste-subject #2',
|
||||||
content: 'copy paste test C' },
|
content: 'copy paste test C' },
|
||||||
|
|
||||||
{ stream: 'Verona', subject: 'copy-paste-subject #2',
|
{ stream: 'Verona', subject: 'copy-paste-subject #2',
|
||||||
content: 'copy paste test D' },
|
content: 'copy paste test D' },
|
||||||
|
|
||||||
{ stream: 'Verona', subject: 'copy-paste-subject #2',
|
{ stream: 'Verona', subject: 'copy-paste-subject #2',
|
||||||
content: 'copy paste test E' },
|
content: 'copy paste test E' },
|
||||||
|
|
||||||
{ stream: 'Verona', subject: 'copy-paste-subject #3',
|
{ stream: 'Verona', subject: 'copy-paste-subject #3',
|
||||||
content: 'copy paste test F' },
|
content: 'copy paste test F' },
|
||||||
|
|
||||||
{ stream: 'Verona', subject: 'copy-paste-subject #3',
|
{ stream: 'Verona', subject: 'copy-paste-subject #3',
|
||||||
content: 'copy paste test G' },
|
content: 'copy paste test G' },
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
|
|
@ -5,8 +5,8 @@ zrequire('components');
|
||||||
|
|
||||||
var noop = function () {};
|
var noop = function () {};
|
||||||
|
|
||||||
var LEFT_KEY = { which: 37, preventDefault: noop, stopPropagation:noop };
|
var LEFT_KEY = { which: 37, preventDefault: noop, stopPropagation: noop };
|
||||||
var RIGHT_KEY = { which: 39, preventDefault: noop, stopPropagation:noop };
|
var RIGHT_KEY = { which: 39, preventDefault: noop, stopPropagation: noop };
|
||||||
|
|
||||||
run_test('basics', () => {
|
run_test('basics', () => {
|
||||||
var keydown_f;
|
var keydown_f;
|
||||||
|
|
|
@ -324,7 +324,7 @@ run_test('marked', () => {
|
||||||
{input: 'T\n@**Cordelia Lear**',
|
{input: 'T\n@**Cordelia Lear**',
|
||||||
expected: '<p>T<br>\n<span class="user-mention" data-user-id="101">@Cordelia Lear</span></p>'},
|
expected: '<p>T<br>\n<span class="user-mention" data-user-id="101">@Cordelia Lear</span></p>'},
|
||||||
{input: '@**Mark Twin|104** and @**Mark Twin|105** are out to confuse you.',
|
{input: '@**Mark Twin|104** and @**Mark Twin|105** are out to confuse you.',
|
||||||
expected:'<p><span class="user-mention" data-user-id="104">@Mark Twin</span> and <span class="user-mention" data-user-id="105">@Mark Twin</span> are out to confuse you.</p>'},
|
expected: '<p><span class="user-mention" data-user-id="104">@Mark Twin</span> and <span class="user-mention" data-user-id="105">@Mark Twin</span> are out to confuse you.</p>'},
|
||||||
{input: '@**Invalid User|1234**',
|
{input: '@**Invalid User|1234**',
|
||||||
expected: '<p>@**Invalid User|1234**</p>'},
|
expected: '<p>@**Invalid User|1234**</p>'},
|
||||||
{input: '@**Cordelia Lear|103** has a wrong user_id.',
|
{input: '@**Cordelia Lear|103** has a wrong user_id.',
|
||||||
|
|
|
@ -219,7 +219,7 @@ run_test('updates', () => {
|
||||||
|
|
||||||
run_test('nth_most_recent_id', () => {
|
run_test('nth_most_recent_id', () => {
|
||||||
var list = new MessageList({});
|
var list = new MessageList({});
|
||||||
list.append([{id:10}, {id:20}, {id:30}]);
|
list.append([{id: 10}, {id: 20}, {id: 30}]);
|
||||||
assert.equal(list.nth_most_recent_id(1), 30);
|
assert.equal(list.nth_most_recent_id(1), 30);
|
||||||
assert.equal(list.nth_most_recent_id(2), 20);
|
assert.equal(list.nth_most_recent_id(2), 20);
|
||||||
assert.equal(list.nth_most_recent_id(3), 10);
|
assert.equal(list.nth_most_recent_id(3), 10);
|
||||||
|
@ -269,8 +269,9 @@ run_test('last_sent_by_me', () => {
|
||||||
|
|
||||||
run_test('local_echo', () => {
|
run_test('local_echo', () => {
|
||||||
var list = new MessageList({});
|
var list = new MessageList({});
|
||||||
list.append([{id:10}, {id:20}, {id:30}, {id:20.02}, {id:20.03}, {id:40}, {id:50}, {id:60}]);
|
list.append([{id: 10}, {id: 20}, {id: 30}, {id: 20.02},
|
||||||
list._local_only = {20.02: {id:20.02}, 20.03: {id:20.03}};
|
{id: 20.03}, {id: 40}, {id: 50}, {id: 60}]);
|
||||||
|
list._local_only = {20.02: {id: 20.02}, 20.03: {id: 20.03}};
|
||||||
|
|
||||||
assert.equal(list.closest_id(10), 10);
|
assert.equal(list.closest_id(10), 10);
|
||||||
assert.equal(list.closest_id(20), 20);
|
assert.equal(list.closest_id(20), 20);
|
||||||
|
@ -292,9 +293,9 @@ run_test('local_echo', () => {
|
||||||
|
|
||||||
list = new MessageList({});
|
list = new MessageList({});
|
||||||
list.append([
|
list.append([
|
||||||
{id:10}, {id:20}, {id:30}, {id:20.02}, {id:20.03}, {id:40},
|
{id: 10}, {id: 20}, {id: 30}, {id: 20.02}, {id: 20.03}, {id: 40},
|
||||||
{id:50}, {id: 50.01}, {id: 50.02}, {id:60}]);
|
{id: 50}, {id: 50.01}, {id: 50.02}, {id: 60}]);
|
||||||
list._local_only = {20.02: {id:20.02}, 20.03: {id:20.03},
|
list._local_only = {20.02: {id: 20.02}, 20.03: {id: 20.03},
|
||||||
50.01: {id: 50.01}, 50.02: {id: 50.02}};
|
50.01: {id: 50.01}, 50.02: {id: 50.02}};
|
||||||
|
|
||||||
assert.equal(list.closest_id(10), 10);
|
assert.equal(list.closest_id(10), 10);
|
||||||
|
|
|
@ -26,7 +26,7 @@ set_global('timerender', {
|
||||||
}
|
}
|
||||||
return [{outerHTML: String(time1.getTime()) + ' - ' + String(time2.getTime())}];
|
return [{outerHTML: String(time1.getTime()) + ' - ' + String(time2.getTime())}];
|
||||||
},
|
},
|
||||||
stringify_time : function (time) {
|
stringify_time: function (time) {
|
||||||
if (page_params.twenty_four_hour_time) {
|
if (page_params.twenty_four_hour_time) {
|
||||||
return time.toString('HH:mm');
|
return time.toString('HH:mm');
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,8 +2,8 @@ set_global("page_params", {
|
||||||
realm_uri: "https://chat.example.com",
|
realm_uri: "https://chat.example.com",
|
||||||
realm_embedded_bots: [
|
realm_embedded_bots: [
|
||||||
{name: "converter", config: {}},
|
{name: "converter", config: {}},
|
||||||
{name:"giphy", config: {key: "12345678"}},
|
{name: "giphy", config: {key: "12345678"}},
|
||||||
{name:"foobot", config: {bar: "baz", qux: "quux"}},
|
{name: "foobot", config: {bar: "baz", qux: "quux"}},
|
||||||
],
|
],
|
||||||
realm_bots: [{api_key: 'QadL788EkiottHmukyhHgePUFHREiu8b',
|
realm_bots: [{api_key: 'QadL788EkiottHmukyhHgePUFHREiu8b',
|
||||||
email: 'error-bot@zulip.org',
|
email: 'error-bot@zulip.org',
|
||||||
|
|
|
@ -210,22 +210,22 @@ run_test('sort_recipients', () => {
|
||||||
|
|
||||||
// For splitting based on recency
|
// For splitting based on recency
|
||||||
global.recent_senders.process_message_for_senders({
|
global.recent_senders.process_message_for_senders({
|
||||||
sender_id : 7,
|
sender_id: 7,
|
||||||
stream_id : 1,
|
stream_id: 1,
|
||||||
subject : "Dev Topic",
|
subject: "Dev Topic",
|
||||||
id : _.uniqueId(),
|
id: _.uniqueId(),
|
||||||
});
|
});
|
||||||
global.recent_senders.process_message_for_senders({
|
global.recent_senders.process_message_for_senders({
|
||||||
sender_id : 5,
|
sender_id: 5,
|
||||||
stream_id : 1,
|
stream_id: 1,
|
||||||
subject : "Dev Topic",
|
subject: "Dev Topic",
|
||||||
id : _.uniqueId(),
|
id: _.uniqueId(),
|
||||||
});
|
});
|
||||||
global.recent_senders.process_message_for_senders({
|
global.recent_senders.process_message_for_senders({
|
||||||
sender_id : 6,
|
sender_id: 6,
|
||||||
stream_id : 1,
|
stream_id: 1,
|
||||||
subject : "Dev Topic",
|
subject: "Dev Topic",
|
||||||
id : _.uniqueId(),
|
id: _.uniqueId(),
|
||||||
});
|
});
|
||||||
|
|
||||||
// Typeahead for stream message [query, stream-name, topic-name]
|
// Typeahead for stream message [query, stream-name, topic-name]
|
||||||
|
@ -240,16 +240,16 @@ run_test('sort_recipients', () => {
|
||||||
]);
|
]);
|
||||||
|
|
||||||
global.recent_senders.process_message_for_senders({
|
global.recent_senders.process_message_for_senders({
|
||||||
sender_id : 5,
|
sender_id: 5,
|
||||||
stream_id : 2,
|
stream_id: 2,
|
||||||
subject : "Linux Topic",
|
subject: "Linux Topic",
|
||||||
id : _.uniqueId(),
|
id: _.uniqueId(),
|
||||||
});
|
});
|
||||||
global.recent_senders.process_message_for_senders({
|
global.recent_senders.process_message_for_senders({
|
||||||
sender_id : 7,
|
sender_id: 7,
|
||||||
stream_id : 2,
|
stream_id: 2,
|
||||||
subject : "Linux Topic",
|
subject: "Linux Topic",
|
||||||
id : _.uniqueId(),
|
id: _.uniqueId(),
|
||||||
});
|
});
|
||||||
|
|
||||||
// No match
|
// No match
|
||||||
|
|
|
@ -446,7 +446,7 @@ run_test('mentions', () => {
|
||||||
stream_id: 999,
|
stream_id: 999,
|
||||||
subject: 'lunch',
|
subject: 'lunch',
|
||||||
mentioned: true,
|
mentioned: true,
|
||||||
unread:true,
|
unread: true,
|
||||||
};
|
};
|
||||||
|
|
||||||
unread.process_loaded_messages([message]);
|
unread.process_loaded_messages([message]);
|
||||||
|
|
|
@ -53,7 +53,7 @@ run_test('lower_bound', () => {
|
||||||
assert.equal(util.lower_bound(arr, 55), 5);
|
assert.equal(util.lower_bound(arr, 55), 5);
|
||||||
assert.equal(util.lower_bound(arr, 2, 4, 31), 3);
|
assert.equal(util.lower_bound(arr, 2, 4, 31), 3);
|
||||||
|
|
||||||
arr = [{x: 10}, {x: 20}, {x:30}];
|
arr = [{x: 10}, {x: 20}, {x: 30}];
|
||||||
|
|
||||||
function compare(a, b) {
|
function compare(a, b) {
|
||||||
return a.x < b;
|
return a.x < b;
|
||||||
|
|
|
@ -118,8 +118,8 @@ class MarkdownComparer {
|
||||||
are_equivalent = this._haveEqualContents(element_actual, element_expected);
|
are_equivalent = this._haveEqualContents(element_actual, element_expected);
|
||||||
if (!are_equivalent) {
|
if (!are_equivalent) {
|
||||||
html = {
|
html = {
|
||||||
actual : this._reorderAttributes(element_actual).innerHTML,
|
actual: this._reorderAttributes(element_actual).innerHTML,
|
||||||
expected : this._reorderAttributes(element_expected).innerHTML,
|
expected: this._reorderAttributes(element_expected).innerHTML,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,7 +137,7 @@ class MarkdownComparer {
|
||||||
|
|
||||||
if (comparison_results.are_equivalent === false) {
|
if (comparison_results.are_equivalent === false) {
|
||||||
throw new assert.AssertionError({
|
throw new assert.AssertionError({
|
||||||
message : message + this._output_formatter(
|
message: message + this._output_formatter(
|
||||||
comparison_results.html.actual,
|
comparison_results.html.actual,
|
||||||
comparison_results.html.expected
|
comparison_results.html.expected
|
||||||
),
|
),
|
||||||
|
@ -153,7 +153,7 @@ class MarkdownComparer {
|
||||||
|
|
||||||
if (comparison_results.are_equivalent) {
|
if (comparison_results.are_equivalent) {
|
||||||
throw new assert.AssertionError({
|
throw new assert.AssertionError({
|
||||||
message : message + [
|
message: message + [
|
||||||
"actual and expected output produce semantially identical HTML",
|
"actual and expected output produce semantially identical HTML",
|
||||||
actual,
|
actual,
|
||||||
"==",
|
"==",
|
||||||
|
|
|
@ -20,9 +20,9 @@ function apply_color(input_string, changes) {
|
||||||
input_string = input_string.slice(2);
|
input_string = input_string.slice(2);
|
||||||
|
|
||||||
const formatter = {
|
const formatter = {
|
||||||
delete : (string) => { return "\u001b[31m" + string + "\u001b[0m"; },
|
delete: (string) => { return "\u001b[31m" + string + "\u001b[0m"; },
|
||||||
insert : (string) => { return "\u001b[32m" + string + "\u001b[0m"; },
|
insert: (string) => { return "\u001b[32m" + string + "\u001b[0m"; },
|
||||||
replace : (string) => { return "\u001b[33m" + string + "\u001b[0m"; },
|
replace: (string) => { return "\u001b[33m" + string + "\u001b[0m"; },
|
||||||
};
|
};
|
||||||
changes.forEach((change) => {
|
changes.forEach((change) => {
|
||||||
if (formatter.hasOwnProperty(change.tag)) {
|
if (formatter.hasOwnProperty(change.tag)) {
|
||||||
|
@ -57,16 +57,16 @@ function parse_questionmark_line(questionmark_line) {
|
||||||
|
|
||||||
const changes_list = [];
|
const changes_list = [];
|
||||||
const aliases = {
|
const aliases = {
|
||||||
"^" : "replace",
|
"^": "replace",
|
||||||
"+" : "insert",
|
"+": "insert",
|
||||||
"-" : "delete",
|
"-": "delete",
|
||||||
};
|
};
|
||||||
const add_change = () => {
|
const add_change = () => {
|
||||||
if (current_sequence) {
|
if (current_sequence) {
|
||||||
changes_list.push({
|
changes_list.push({
|
||||||
tag : aliases[current_sequence],
|
tag: aliases[current_sequence],
|
||||||
beginning_index,
|
beginning_index,
|
||||||
ending_index : index,
|
ending_index: index,
|
||||||
});
|
});
|
||||||
current_sequence = "";
|
current_sequence = "";
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@ var admin_settings_label = {
|
||||||
|
|
||||||
// Organization permissions
|
// Organization permissions
|
||||||
realm_name_changes_disabled: i18n.t("Prevent users from changing their name"),
|
realm_name_changes_disabled: i18n.t("Prevent users from changing their name"),
|
||||||
realm_email_changes_disabled : i18n.t("Prevent users from changing their email address"),
|
realm_email_changes_disabled: i18n.t("Prevent users from changing their email address"),
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.build_page = function () {
|
exports.build_page = function () {
|
||||||
|
|
|
@ -98,9 +98,9 @@ $(function () {
|
||||||
stripe_token: JSON.stringify(stripe_token.id),
|
stripe_token: JSON.stringify(stripe_token.id),
|
||||||
csrfmiddlewaretoken: $("#autopay-form input[name='csrf']").val(),
|
csrfmiddlewaretoken: $("#autopay-form input[name='csrf']").val(),
|
||||||
signed_seat_count: get_form_input("signed_seat_count"),
|
signed_seat_count: get_form_input("signed_seat_count"),
|
||||||
salt: get_form_input("salt"),
|
salt: get_form_input("salt"),
|
||||||
plan: get_form_input("plan"),
|
plan: get_form_input("plan"),
|
||||||
billing_modality: get_form_input("billing_modality"),
|
billing_modality: get_form_input("billing_modality"),
|
||||||
},
|
},
|
||||||
success: function () {
|
success: function () {
|
||||||
$("#autopay-loading").hide();
|
$("#autopay-loading").hide();
|
||||||
|
@ -156,8 +156,8 @@ $(function () {
|
||||||
signed_seat_count: get_form_input("signed_seat_count"),
|
signed_seat_count: get_form_input("signed_seat_count"),
|
||||||
salt: get_form_input("salt"),
|
salt: get_form_input("salt"),
|
||||||
plan: get_form_input("plan"),
|
plan: get_form_input("plan"),
|
||||||
billing_modality: get_form_input("billing_modality"),
|
billing_modality: get_form_input("billing_modality"),
|
||||||
invoiced_seat_count: get_form_input("invoiced_seat_count", false),
|
invoiced_seat_count: get_form_input("invoiced_seat_count", false),
|
||||||
},
|
},
|
||||||
success: function () {
|
success: function () {
|
||||||
$("#invoice-loading").hide();
|
$("#invoice-loading").hide();
|
||||||
|
|
|
@ -15,7 +15,7 @@ exports.max_size_before_shrinking = 600;
|
||||||
|
|
||||||
var presence_descriptions = {
|
var presence_descriptions = {
|
||||||
active: 'is active',
|
active: 'is active',
|
||||||
idle: 'is not active',
|
idle: 'is not active',
|
||||||
};
|
};
|
||||||
|
|
||||||
var fade_config = {
|
var fade_config = {
|
||||||
|
|
|
@ -562,8 +562,8 @@ exports.initialize = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
channel.post({
|
channel.post({
|
||||||
url: "/accounts/webathena_kerberos_login/",
|
url: "/accounts/webathena_kerberos_login/",
|
||||||
data: {cred: JSON.stringify(r.session)},
|
data: {cred: JSON.stringify(r.session)},
|
||||||
success: function () {
|
success: function () {
|
||||||
$("#zephyr-mirror-error").removeClass("show");
|
$("#zephyr-mirror-error").removeClass("show");
|
||||||
},
|
},
|
||||||
|
|
|
@ -170,11 +170,11 @@ exports.maybe_scroll_up_selected_message = function () {
|
||||||
|
|
||||||
function fill_in_opts_from_current_narrowed_view(msg_type, opts) {
|
function fill_in_opts_from_current_narrowed_view(msg_type, opts) {
|
||||||
var default_opts = {
|
var default_opts = {
|
||||||
message_type: msg_type,
|
message_type: msg_type,
|
||||||
stream: '',
|
stream: '',
|
||||||
topic: '',
|
topic: '',
|
||||||
private_message_recipient: '',
|
private_message_recipient: '',
|
||||||
trigger: 'unknown',
|
trigger: 'unknown',
|
||||||
};
|
};
|
||||||
|
|
||||||
// Set default parameters based on the current narrowed view.
|
// Set default parameters based on the current narrowed view.
|
||||||
|
|
|
@ -583,10 +583,10 @@ exports.render_emoji_popover = function (elt, id) {
|
||||||
elt.popover({
|
elt.popover({
|
||||||
// temporary patch for handling popover placement of `viewport_center`
|
// temporary patch for handling popover placement of `viewport_center`
|
||||||
placement: placement === 'viewport_center' ? 'left' : placement,
|
placement: placement === 'viewport_center' ? 'left' : placement,
|
||||||
template: template,
|
template: template,
|
||||||
title: "",
|
title: "",
|
||||||
content: generate_emoji_picker_content(id),
|
content: generate_emoji_picker_content(id),
|
||||||
trigger: "manual",
|
trigger: "manual",
|
||||||
});
|
});
|
||||||
elt.popover("show");
|
elt.popover("show");
|
||||||
elt.prop("title", i18n.t("Add emoji reaction (:)"));
|
elt.prop("title", i18n.t("Add emoji reaction (:)"));
|
||||||
|
|
|
@ -93,7 +93,7 @@ function do_hashchange_normal(from_reload) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
var narrow_opts = {
|
var narrow_opts = {
|
||||||
change_hash: false, // already set
|
change_hash: false, // already set
|
||||||
trigger: 'hash change',
|
trigger: 'hash change',
|
||||||
};
|
};
|
||||||
if (from_reload) {
|
if (from_reload) {
|
||||||
|
|
|
@ -79,7 +79,7 @@ exports.show = function (target) {
|
||||||
|
|
||||||
if (!overlay.hasClass("show")) {
|
if (!overlay.hasClass("show")) {
|
||||||
overlays.open_overlay({
|
overlays.open_overlay({
|
||||||
name: 'informationalOverlays',
|
name: 'informationalOverlays',
|
||||||
overlay: overlay,
|
overlay: overlay,
|
||||||
on_close: function () {
|
on_close: function () {
|
||||||
hashchange.changehash("");
|
hashchange.changehash("");
|
||||||
|
|
|
@ -9,10 +9,10 @@ function maybe_add_narrowed_messages(messages, msg_list, messages_are_new) {
|
||||||
});
|
});
|
||||||
|
|
||||||
channel.get({
|
channel.get({
|
||||||
url: '/json/messages/matches_narrow',
|
url: '/json/messages/matches_narrow',
|
||||||
data: {msg_ids: JSON.stringify(ids),
|
data: {msg_ids: JSON.stringify(ids),
|
||||||
narrow: JSON.stringify(narrow_state.public_operators())},
|
narrow: JSON.stringify(narrow_state.public_operators())},
|
||||||
timeout: 5000,
|
timeout: 5000,
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
if (msg_list !== current_msg_list) {
|
if (msg_list !== current_msg_list) {
|
||||||
// We unnarrowed in the mean time
|
// We unnarrowed in the mean time
|
||||||
|
|
|
@ -141,8 +141,8 @@ exports.load_messages = function (opts) {
|
||||||
data.client_gravatar = true;
|
data.client_gravatar = true;
|
||||||
|
|
||||||
channel.get({
|
channel.get({
|
||||||
url: '/json/messages',
|
url: '/json/messages',
|
||||||
data: data,
|
data: data,
|
||||||
idempotent: true,
|
idempotent: true,
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
get_messages_success(data, opts);
|
get_messages_success(data, opts);
|
||||||
|
|
|
@ -36,12 +36,12 @@ exports.send_read = (function () {
|
||||||
// call finishes, they will be handled in the success callback.
|
// call finishes, they will be handled in the success callback.
|
||||||
|
|
||||||
channel.post({
|
channel.post({
|
||||||
url: '/json/messages/flags',
|
url: '/json/messages/flags',
|
||||||
idempotent: true,
|
idempotent: true,
|
||||||
data: {messages: JSON.stringify(real_msg_ids),
|
data: {messages: JSON.stringify(real_msg_ids),
|
||||||
op: 'add',
|
op: 'add',
|
||||||
flag: 'read'},
|
flag: 'read'},
|
||||||
success: on_success,
|
success: on_success,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -19,9 +19,9 @@ function update_pointer() {
|
||||||
if (!pointer_update_in_flight) {
|
if (!pointer_update_in_flight) {
|
||||||
pointer_update_in_flight = true;
|
pointer_update_in_flight = true;
|
||||||
return channel.post({
|
return channel.post({
|
||||||
url: '/json/users/me/pointer',
|
url: '/json/users/me/pointer',
|
||||||
idempotent: true,
|
idempotent: true,
|
||||||
data: {pointer: pointer.furthest_read},
|
data: {pointer: pointer.furthest_read},
|
||||||
success: function () {
|
success: function () {
|
||||||
pointer.server_furthest_read = pointer.furthest_read;
|
pointer.server_furthest_read = pointer.furthest_read;
|
||||||
pointer_update_in_flight = false;
|
pointer_update_in_flight = false;
|
||||||
|
|
|
@ -422,9 +422,9 @@ exports.toggle_actions_popover = function (element, id) {
|
||||||
elt.popover({
|
elt.popover({
|
||||||
// Popover height with 7 items in it is ~190 px
|
// Popover height with 7 items in it is ~190 px
|
||||||
placement: message_viewport.height() - ypos < 220 ? 'top' : 'bottom',
|
placement: message_viewport.height() - ypos < 220 ? 'top' : 'bottom',
|
||||||
title: "",
|
title: "",
|
||||||
content: templates.render('actions_popover_content', args),
|
content: templates.render('actions_popover_content', args),
|
||||||
trigger: "manual",
|
trigger: "manual",
|
||||||
});
|
});
|
||||||
elt.popover("show");
|
elt.popover("show");
|
||||||
current_actions_popover_elem = elt;
|
current_actions_popover_elem = elt;
|
||||||
|
@ -445,9 +445,9 @@ exports.render_actions_remind_popover = function (element, id) {
|
||||||
elt.popover({
|
elt.popover({
|
||||||
// Popover height with 7 items in it is ~190 px
|
// Popover height with 7 items in it is ~190 px
|
||||||
placement: message_viewport.height() - ypos < 220 ? 'top' : 'bottom',
|
placement: message_viewport.height() - ypos < 220 ? 'top' : 'bottom',
|
||||||
title: "",
|
title: "",
|
||||||
content: templates.render('remind_me_popover_content', args),
|
content: templates.render('remind_me_popover_content', args),
|
||||||
trigger: "manual",
|
trigger: "manual",
|
||||||
});
|
});
|
||||||
elt.popover("show");
|
elt.popover("show");
|
||||||
current_flatpickr_instance = $('.remind.custom[data-message-id="' + message.id + '"]').flatpickr({
|
current_flatpickr_instance = $('.remind.custom[data-message-id="' + message.id + '"]').flatpickr({
|
||||||
|
|
|
@ -370,7 +370,7 @@ function integration_events() {
|
||||||
$(".integrations .searchbar input[type='text']")
|
$(".integrations .searchbar input[type='text']")
|
||||||
.focus()
|
.focus()
|
||||||
.on('input', function (e) {
|
.on('input', function (e) {
|
||||||
dispatch('UPDATE_QUERY', { query : e.target.value.toLowerCase() });
|
dispatch('UPDATE_QUERY', { query: e.target.value.toLowerCase() });
|
||||||
});
|
});
|
||||||
|
|
||||||
$(window).scroll(function () {
|
$(window).scroll(function () {
|
||||||
|
|
|
@ -31,7 +31,7 @@ $(function () {
|
||||||
|
|
||||||
$('#registration, #password_reset').validate({
|
$('#registration, #password_reset').validate({
|
||||||
rules: {
|
rules: {
|
||||||
password: 'password_strength',
|
password: 'password_strength',
|
||||||
new_password1: 'password_strength',
|
new_password1: 'password_strength',
|
||||||
},
|
},
|
||||||
errorElement: "p",
|
errorElement: "p",
|
||||||
|
@ -45,7 +45,7 @@ $(function () {
|
||||||
error.insertAfter(element).addClass('help-inline alert alert-error');
|
error.insertAfter(element).addClass('help-inline alert alert-error');
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
highlight: highlight('error'),
|
highlight: highlight('error'),
|
||||||
unhighlight: highlight('success'),
|
unhighlight: highlight('success'),
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -185,10 +185,10 @@ function get_events(options) {
|
||||||
|
|
||||||
get_events_timeout = undefined;
|
get_events_timeout = undefined;
|
||||||
get_events_xhr = channel.get({
|
get_events_xhr = channel.get({
|
||||||
url: '/json/events',
|
url: '/json/events',
|
||||||
data: get_events_params,
|
data: get_events_params,
|
||||||
idempotent: true,
|
idempotent: true,
|
||||||
timeout: page_params.poll_timeout,
|
timeout: page_params.poll_timeout,
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
exports.suspect_offline = false;
|
exports.suspect_offline = false;
|
||||||
try {
|
try {
|
||||||
|
@ -303,8 +303,8 @@ exports.cleanup_event_queue = function cleanup_event_queue() {
|
||||||
// Set expired because in a reload we may be called twice.
|
// Set expired because in a reload we may be called twice.
|
||||||
page_params.event_queue_expired = true;
|
page_params.event_queue_expired = true;
|
||||||
channel.del({
|
channel.del({
|
||||||
url: '/json/events',
|
url: '/json/events',
|
||||||
data: {queue_id: page_params.queue_id},
|
data: {queue_id: page_params.queue_id},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -57,7 +57,7 @@ exports.set_up = function () {
|
||||||
channel.get({
|
channel.get({
|
||||||
url: '/json/invites',
|
url: '/json/invites',
|
||||||
idempotent: true,
|
idempotent: true,
|
||||||
timeout: 10 * 1000,
|
timeout: 10 * 1000,
|
||||||
success: exports.on_load_success,
|
success: exports.on_load_success,
|
||||||
error: failed_listing_invites,
|
error: failed_listing_invites,
|
||||||
});
|
});
|
||||||
|
|
|
@ -3,10 +3,10 @@ var settings_notifications = (function () {
|
||||||
var exports = {};
|
var exports = {};
|
||||||
|
|
||||||
var stream_notification_settings = [
|
var stream_notification_settings = [
|
||||||
{setting: "enable_stream_desktop_notifications", notifications:"desktop_notifications"},
|
{setting: "enable_stream_desktop_notifications", notifications: "desktop_notifications"},
|
||||||
{setting: "enable_stream_push_notifications", notifications:"push_notifications"},
|
{setting: "enable_stream_push_notifications", notifications: "push_notifications"},
|
||||||
{setting: "enable_stream_sounds", notifications:"audible_notifications"},
|
{setting: "enable_stream_sounds", notifications: "audible_notifications"},
|
||||||
{setting: "enable_stream_email_notifications", notifications:"email_notifications"},
|
{setting: "enable_stream_email_notifications", notifications: "email_notifications"},
|
||||||
];
|
];
|
||||||
|
|
||||||
var pm_mention_notification_settings = [
|
var pm_mention_notification_settings = [
|
||||||
|
|
|
@ -1084,7 +1084,7 @@ exports.build_page = function () {
|
||||||
overlays.close_modal('deactivate-realm-modal');
|
overlays.close_modal('deactivate-realm-modal');
|
||||||
}
|
}
|
||||||
channel.post({
|
channel.post({
|
||||||
url:'/json/realm/deactivate',
|
url: '/json/realm/deactivate',
|
||||||
error: function (xhr) {
|
error: function (xhr) {
|
||||||
ui_report.error(
|
ui_report.error(
|
||||||
i18n.t("Failed"), xhr, $('#admin-realm-deactivation-status').expectOne()
|
i18n.t("Failed"), xhr, $('#admin-realm-deactivation-status').expectOne()
|
||||||
|
|
|
@ -206,9 +206,9 @@ exports.set_up = function () {
|
||||||
|
|
||||||
// Populate users and bots tables
|
// Populate users and bots tables
|
||||||
channel.get({
|
channel.get({
|
||||||
url: '/json/users',
|
url: '/json/users',
|
||||||
idempotent: true,
|
idempotent: true,
|
||||||
timeout: 10 * 1000,
|
timeout: 10 * 1000,
|
||||||
success: exports.on_load_success,
|
success: exports.on_load_success,
|
||||||
error: failed_listing_users,
|
error: failed_listing_users,
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
var Socket = (function () {
|
var Socket = (function () {
|
||||||
|
|
||||||
var CLOSE_REASONS = {
|
var CLOSE_REASONS = {
|
||||||
none_given: {code: 4000, msg: "No reason provided"},
|
none_given: {code: 4000, msg: "No reason provided"},
|
||||||
no_heartbeat: {code: 4001, msg: "Missed too many heartbeats"},
|
no_heartbeat: {code: 4001, msg: "Missed too many heartbeats"},
|
||||||
auth_fail: {code: 4002, msg: "Authentication failed"},
|
auth_fail: {code: 4002, msg: "Authentication failed"},
|
||||||
ack_timeout: {code: 4003, msg: "ACK timeout"},
|
ack_timeout: {code: 4003, msg: "ACK timeout"},
|
||||||
cant_send: {code: 4004, msg: "User attempted to send while Socket was not ready"},
|
cant_send: {code: 4004, msg: "User attempted to send while Socket was not ready"},
|
||||||
unsuspend: {code: 4005, msg: "Got unsuspend event"},
|
unsuspend: {code: 4005, msg: "Got unsuspend event"},
|
||||||
};
|
};
|
||||||
|
|
||||||
function Socket(url) {
|
function Socket(url) {
|
||||||
|
|
|
@ -179,7 +179,7 @@ exports.get_server_history = function (stream_id, on_success) {
|
||||||
channel.get({
|
channel.get({
|
||||||
url: url,
|
url: url,
|
||||||
data: {},
|
data: {},
|
||||||
success: function (data) {
|
success: function (data) {
|
||||||
var server_history = data.topics;
|
var server_history = data.topics;
|
||||||
exports.add_history(stream_id, server_history);
|
exports.add_history(stream_id, server_history);
|
||||||
on_success();
|
on_success();
|
||||||
|
|
|
@ -4,9 +4,9 @@ var exports = {};
|
||||||
|
|
||||||
function set_tutorial_status(status, callback) {
|
function set_tutorial_status(status, callback) {
|
||||||
return channel.post({
|
return channel.post({
|
||||||
url: '/json/users/me/tutorial_status',
|
url: '/json/users/me/tutorial_status',
|
||||||
data: {status: JSON.stringify(status)},
|
data: {status: JSON.stringify(status)},
|
||||||
success: callback,
|
success: callback,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,9 +7,9 @@ exports.mark_all_as_read = function (cont) {
|
||||||
unread_ui.update_unread_counts();
|
unread_ui.update_unread_counts();
|
||||||
|
|
||||||
channel.post({
|
channel.post({
|
||||||
url: '/json/mark_all_as_read',
|
url: '/json/mark_all_as_read',
|
||||||
idempotent: true,
|
idempotent: true,
|
||||||
success: cont});
|
success: cont});
|
||||||
};
|
};
|
||||||
|
|
||||||
function process_newly_read_message(message, options) {
|
function process_newly_read_message(message, options) {
|
||||||
|
|
Loading…
Reference in New Issue