mirror of
https://github.com/zulip/zulip.git
synced 2025-10-23 04:52:12 +00:00
js: Remove extra consecutive spaces.
Prettier would do this anyway, but it’s separated out for a more reviewable diff. Generated by ESLint. Signed-off-by: Anders Kaseorg <anders@zulip.com>
This commit is contained in:
committed by
Tim Abbott
parent
883e2fd325
commit
8046b6477a
@@ -78,6 +78,7 @@
|
||||
"no-label-var": "error",
|
||||
"no-labels": "error",
|
||||
"no-loop-func": "error",
|
||||
"no-multi-spaces": "error",
|
||||
"no-multi-str": "error",
|
||||
"no-native-reassign": "error",
|
||||
"no-new-func": "error",
|
||||
|
@@ -4,7 +4,7 @@ module.exports = {
|
||||
"@babel/preset-env",
|
||||
{
|
||||
corejs: 3,
|
||||
loose: true, // Loose mode for…of loops are 5× faster in Firefox
|
||||
loose: true, // Loose mode for…of loops are 5× faster in Firefox
|
||||
useBuiltIns: "usage",
|
||||
},
|
||||
],
|
||||
|
@@ -164,7 +164,7 @@ casper.then(function () {
|
||||
// Make sure multiple PM recipients display properly.
|
||||
var recipients = ["cordelia@zulip.com", "othello@zulip.com"];
|
||||
casper.then(function () {
|
||||
common.keypress(27); // escape to dismiss compose box
|
||||
common.keypress(27); // escape to dismiss compose box
|
||||
});
|
||||
casper.waitWhileVisible(".message_comp");
|
||||
common.then_send_message("private", {
|
||||
@@ -175,7 +175,7 @@ common.then_send_message("private", {
|
||||
|
||||
|
||||
casper.then(function () {
|
||||
common.keypress(27); // escape to dismiss compose box
|
||||
common.keypress(27); // escape to dismiss compose box
|
||||
});
|
||||
casper.then(function () {
|
||||
common.un_narrow();
|
||||
|
@@ -21,7 +21,7 @@ run_test("rgb_luminance", () => {
|
||||
|
||||
run_test("luminance_to_lightness", () => {
|
||||
let luminance = 0;
|
||||
let expected_value = 116 * 4 / 29 - 16;
|
||||
let expected_value = 116 * 4 / 29 - 16;
|
||||
let actual_value = colorspace.luminance_to_lightness(luminance);
|
||||
assert.equal(actual_value, expected_value);
|
||||
|
||||
|
@@ -373,7 +373,7 @@ run_test("markdown_rtl", () => {
|
||||
const textarea = $("#compose-textarea");
|
||||
|
||||
const event = {
|
||||
keyCode: 65, // A
|
||||
keyCode: 65, // A
|
||||
};
|
||||
|
||||
rtl.get_direction = (text) => {
|
||||
@@ -397,7 +397,7 @@ run_test("markdown_ltr", () => {
|
||||
const textarea = $("#compose-textarea");
|
||||
|
||||
const event = {
|
||||
keyCode: 65, // A
|
||||
keyCode: 65, // A
|
||||
};
|
||||
|
||||
assert.equal(textarea.hasClass("rtl"), true);
|
||||
@@ -1100,7 +1100,7 @@ run_test("needs_subscribe_warning", () => {
|
||||
});
|
||||
|
||||
run_test("warn_if_mentioning_unsubscribed_user", () => {
|
||||
let mentioned = {
|
||||
let mentioned = {
|
||||
email: "foo@bar.com",
|
||||
};
|
||||
|
||||
@@ -1287,7 +1287,7 @@ run_test("on_events", () => {
|
||||
invite_user_to_stream_called = true;
|
||||
assert.deepEqual(user_ids, [mentioned.user_id]);
|
||||
assert.equal(sub, subscription);
|
||||
success(); // This will check success callback path.
|
||||
success(); // This will check success callback path.
|
||||
};
|
||||
|
||||
const helper = setup_parents_and_mock_remove(
|
||||
|
@@ -302,7 +302,7 @@ run_test("content_typeahead_selected", () => {
|
||||
let caret_called1 = false;
|
||||
let caret_called2 = false;
|
||||
fake_this.$element.caret = function (...args) {
|
||||
if (args.length === 0) { // .caret() used in split_at_cursor
|
||||
if (args.length === 0) { // .caret() used in split_at_cursor
|
||||
caret_called1 = true;
|
||||
return fake_this.query.length;
|
||||
}
|
||||
@@ -415,7 +415,7 @@ run_test("content_typeahead_selected", () => {
|
||||
expected_value = "@_**King Hamlet** ";
|
||||
assert.equal(actual_value, expected_value);
|
||||
|
||||
fake_this.query = "@_**kin";
|
||||
fake_this.query = "@_**kin";
|
||||
fake_this.token = "kin";
|
||||
actual_value = ct.content_typeahead_selected.call(fake_this, hamlet);
|
||||
expected_value = "@_**King Hamlet** ";
|
||||
@@ -606,7 +606,7 @@ run_test("initialize", () => {
|
||||
// The sorter should return the query as the first element if there
|
||||
// isn't a topic with such name.
|
||||
// This only happens if typeahead is providing other suggestions.
|
||||
options.query = "e"; // Letter present in "furniture" and "ice"
|
||||
options.query = "e"; // Letter present in "furniture" and "ice"
|
||||
actual_value = options.sorter(["furniture", "ice"]);
|
||||
expected_value = ["e", "furniture", "ice"];
|
||||
assert.deepEqual(actual_value, expected_value);
|
||||
@@ -663,11 +663,11 @@ run_test("initialize", () => {
|
||||
}
|
||||
|
||||
let query;
|
||||
query = "el"; // Matches both "othELlo" and "cordELia"
|
||||
query = "el"; // Matches both "othELlo" and "cordELia"
|
||||
assert.equal(matcher(query, othello), true);
|
||||
assert.equal(matcher(query, cordelia), true);
|
||||
|
||||
query = "bender"; // Doesn't exist
|
||||
query = "bender"; // Doesn't exist
|
||||
assert.equal(matcher(query, othello), false);
|
||||
assert.equal(matcher(query, cordelia), false);
|
||||
|
||||
@@ -724,7 +724,7 @@ run_test("initialize", () => {
|
||||
assert.deepEqual(actual_value, expected_value);
|
||||
|
||||
// A literal match at the beginning of an element puts it at the top.
|
||||
query = "co"; // Matches everything ("x@zulip.COm")
|
||||
query = "co"; // Matches everything ("x@zulip.COm")
|
||||
actual_value = sorter(query, [othello, deactivated_user, cordelia]);
|
||||
expected_value = [cordelia, deactivated_user, othello];
|
||||
assert.deepEqual(actual_value, expected_value);
|
||||
@@ -946,13 +946,13 @@ run_test("initialize", () => {
|
||||
let pm_recipient_blur_called = false;
|
||||
const old_pm_recipient_blur = $("#private_message_recipient").blur;
|
||||
$("#private_message_recipient").blur = function (handler) {
|
||||
if (handler) { // The blur handler is being set.
|
||||
if (handler) { // The blur handler is being set.
|
||||
this.val("othello@zulip.com, ");
|
||||
handler.call(this);
|
||||
const actual_value = this.val();
|
||||
const expected_value = "othello@zulip.com";
|
||||
assert.equal(actual_value, expected_value);
|
||||
} else { // The element is simply losing the focus.
|
||||
} else { // The element is simply losing the focus.
|
||||
old_pm_recipient_blur();
|
||||
}
|
||||
pm_recipient_blur_called = true;
|
||||
@@ -1076,10 +1076,10 @@ run_test("initialize", () => {
|
||||
// in_handler tries to avoid.
|
||||
$("#stream_message_recipient_stream").one = function (event, handler) {
|
||||
handler({preventDefault: noop});
|
||||
f(); // This time in_handler will already be true.
|
||||
f(); // This time in_handler will already be true.
|
||||
stream_one_called = true;
|
||||
};
|
||||
f(); // Here in_handler is false.
|
||||
f(); // Here in_handler is false.
|
||||
focus_handler_called = true;
|
||||
};
|
||||
|
||||
|
@@ -361,7 +361,7 @@ with_overrides((override) => {
|
||||
event = event_fixtures.realm__update_notifications_stream_id;
|
||||
dispatch(event);
|
||||
assert_same(page_params.realm_notifications_stream_id, 42);
|
||||
page_params.realm_notifications_stream_id = -1; // make sure to reset for future tests
|
||||
page_params.realm_notifications_stream_id = -1; // make sure to reset for future tests
|
||||
|
||||
event = event_fixtures.realm__update_signup_notifications_stream_id;
|
||||
dispatch(event);
|
||||
@@ -687,7 +687,7 @@ with_overrides((override) => {
|
||||
assert_same(toggled, ["less_dense_mode", "more_dense_mode"]);
|
||||
|
||||
$("body").fadeOut = (secs) => { assert_same(secs, 300); };
|
||||
$("body").fadeIn = (secs) => { assert_same(secs, 300); };
|
||||
$("body").fadeIn = (secs) => { assert_same(secs, 300); };
|
||||
|
||||
global.with_stub((stub) => {
|
||||
event = event_fixtures.update_display_settings__color_scheme_dark;
|
||||
|
@@ -231,7 +231,7 @@ run_test("remove_old_drafts", () => {
|
||||
run_test("format_drafts", () => {
|
||||
drafts.remove_old_drafts = noop;
|
||||
|
||||
draft_1.updatedAt = new Date(1549958107000).getTime(); // 2/12/2019 07:55:07 AM (UTC+0)
|
||||
draft_1.updatedAt = new Date(1549958107000).getTime(); // 2/12/2019 07:55:07 AM (UTC+0)
|
||||
draft_2.updatedAt = new Date(1549958107000).setDate(-1);
|
||||
const draft_3 = {
|
||||
stream: "stream 2",
|
||||
|
@@ -34,7 +34,7 @@ run_test("basic_functions", () => {
|
||||
const widget = dropdown_list_widget(opts);
|
||||
|
||||
assert.equal(widget.value(), "one");
|
||||
assert.equal(updated_value, undefined); // We haven't 'updated' the widget yet.
|
||||
assert.equal(updated_value, undefined); // We haven't 'updated' the widget yet.
|
||||
assert(reset_button.visible());
|
||||
|
||||
widget.update("two");
|
||||
|
@@ -499,7 +499,7 @@ run_test("custom sort", () => {
|
||||
|
||||
list_render.create(container, list, {
|
||||
name: "custom-sort-list",
|
||||
modifier: (n) => "(" + n.x + ", " + n.y + ")",
|
||||
modifier: (n) => "(" + n.x + ", " + n.y + ")",
|
||||
sort_fields: {
|
||||
product: sort_by_product,
|
||||
x_value: sort_by_x,
|
||||
@@ -740,7 +740,7 @@ run_test("opts.get_item", () => {
|
||||
|
||||
run_test("render item", () => {
|
||||
const container = make_container();
|
||||
const scroll_container = make_scroll_container();
|
||||
const scroll_container = make_scroll_container();
|
||||
const INITIAL_RENDER_COUNT = 80; // Keep this in sync with the actual code.
|
||||
container.html = () => {};
|
||||
let called = false;
|
||||
|
@@ -127,7 +127,7 @@ run_test("update_messages", () => {
|
||||
|
||||
helper.verify();
|
||||
|
||||
assert.deepEqual(rendered_mgs, [
|
||||
assert.deepEqual(rendered_mgs, [
|
||||
{
|
||||
alerted: false,
|
||||
collapsed: false,
|
||||
|
@@ -49,7 +49,7 @@ const cindy = {
|
||||
full_name: "Cindy",
|
||||
};
|
||||
|
||||
const denise = {
|
||||
const denise = {
|
||||
email: "denise@example.com",
|
||||
user_id: 105,
|
||||
full_name: "Denise ",
|
||||
|
@@ -61,7 +61,7 @@ run_test("poll_data_holder my question", () => {
|
||||
question: "best plan?",
|
||||
});
|
||||
|
||||
let vote_event = {
|
||||
let vote_event = {
|
||||
type: "vote",
|
||||
key: "99,1",
|
||||
vote: 1,
|
||||
@@ -146,7 +146,7 @@ run_test("activate another person poll", () => {
|
||||
|
||||
const widget_elem = $("<div>").addClass("widget-content");
|
||||
|
||||
let out_data; // Used to check the event data sent to the server
|
||||
let out_data; // Used to check the event data sent to the server
|
||||
const callback = (data) => {
|
||||
out_data = data;
|
||||
};
|
||||
@@ -242,7 +242,7 @@ run_test("activate another person poll", () => {
|
||||
poll_option_input.val("cool choice");
|
||||
out_data = undefined;
|
||||
option_button_callback(e);
|
||||
assert.deepEqual(out_data, {type: "new_option", idx: 1, option: "cool choice"});
|
||||
assert.deepEqual(out_data, {type: "new_option", idx: 1, option: "cool choice"});
|
||||
|
||||
poll_option_input.val("");
|
||||
out_data = undefined;
|
||||
@@ -405,7 +405,7 @@ run_test("activate own poll", () => {
|
||||
out_data = undefined;
|
||||
show_submit = true;
|
||||
question_button_callback(e);
|
||||
assert.deepEqual(out_data, {type: "question", question: "Is it new?"});
|
||||
assert.deepEqual(out_data, {type: "question", question: "Is it new?"});
|
||||
|
||||
poll_option_input.val("");
|
||||
out_data = undefined;
|
||||
|
@@ -10,7 +10,7 @@ zrequire("user_status");
|
||||
zrequire("feature_flags");
|
||||
zrequire("message_edit");
|
||||
|
||||
const noop = function () {};
|
||||
const noop = function () {};
|
||||
$.fn.popover = noop; // this will get wrapped by our code
|
||||
|
||||
zrequire("popovers");
|
||||
|
@@ -236,7 +236,7 @@ run_test("sending", () => {
|
||||
});
|
||||
});
|
||||
|
||||
emoji_name = "unknown-emoji"; // Test sending an emoji unknown to frontend.
|
||||
emoji_name = "unknown-emoji"; // Test sending an emoji unknown to frontend.
|
||||
blueslip.expect("warn", "Bad emoji name: " + emoji_name);
|
||||
reactions.toggle_emoji_reaction(message_id, emoji_name);
|
||||
reactions.add_reaction = orig_add_reaction;
|
||||
@@ -592,7 +592,7 @@ run_test("error_handling", () => {
|
||||
|
||||
blueslip.expect("error", "reactions: Bad message id: 55");
|
||||
|
||||
const bogus_event = {
|
||||
const bogus_event = {
|
||||
message_id: 55,
|
||||
reaction_type: "realm_emoji",
|
||||
emoji_name: "realm_emoji",
|
||||
|
@@ -80,13 +80,13 @@ const stream4 = 4;
|
||||
const stream5 = 5; // Deleted stream
|
||||
|
||||
// Topics in the stream, all unread except topic1 & stream1.
|
||||
const topic1 = "topic-1"; // No Other sender & read.
|
||||
const topic2 = "topic-2"; // Other sender
|
||||
const topic3 = "topic-3"; // User not present
|
||||
const topic4 = "topic-4"; // User not present
|
||||
const topic5 = "topic-5"; // other sender
|
||||
const topic6 = "topic-6"; // other sender
|
||||
const topic7 = "topic-7"; // muted topic
|
||||
const topic1 = "topic-1"; // No Other sender & read.
|
||||
const topic2 = "topic-2"; // Other sender
|
||||
const topic3 = "topic-3"; // User not present
|
||||
const topic4 = "topic-4"; // User not present
|
||||
const topic5 = "topic-5"; // other sender
|
||||
const topic6 = "topic-6"; // other sender
|
||||
const topic7 = "topic-7"; // muted topic
|
||||
const topic8 = "topic-8";
|
||||
const topic9 = "topic-9";
|
||||
const topic10 = "topic-10";
|
||||
|
@@ -876,7 +876,7 @@ run_test("topic_suggestions", () => {
|
||||
assert.equal(describe("te"), "Search for te");
|
||||
assert.equal(describe("stream:office topic:team"), "Stream office > team");
|
||||
|
||||
suggestions = get_suggestions("topic:staplers", "stream:office");
|
||||
suggestions = get_suggestions("topic:staplers", "stream:office");
|
||||
expected = [
|
||||
"stream:office",
|
||||
];
|
||||
|
@@ -165,7 +165,7 @@ function createSaveButtons(subsection) {
|
||||
save_button_controls.set_find_results(
|
||||
".discard-button", stub_discard_button,
|
||||
);
|
||||
const props = {};
|
||||
const props = {};
|
||||
props.hidden = false;
|
||||
save_button_controls.fadeIn = () => {
|
||||
props.hidden = false;
|
||||
|
@@ -150,7 +150,7 @@ run_test("update_property", () => {
|
||||
});
|
||||
const args = stub.get_args("sub", "val");
|
||||
assert.equal(args.sub.stream_id, 1);
|
||||
assert.deepEqual(args.val, {
|
||||
assert.deepEqual(args.val, {
|
||||
invite_only: true,
|
||||
history_public_to_subscribers: true,
|
||||
});
|
||||
|
@@ -116,9 +116,9 @@ run_test("create_sidebar_row", () => {
|
||||
assert(topic_list_cleared);
|
||||
|
||||
const expected_elems = [
|
||||
devel_sidebar, //pinned
|
||||
split, //separator
|
||||
social_sidebar, //not pinned
|
||||
devel_sidebar, //pinned
|
||||
split, //separator
|
||||
social_sidebar, //not pinned
|
||||
];
|
||||
|
||||
assert.deepEqual(appended_elems, expected_elems);
|
||||
@@ -229,7 +229,7 @@ function add_row(sub) {
|
||||
const html = "<" + sub.name + " sidebar row html>";
|
||||
const obj = $(html);
|
||||
|
||||
obj.length = 1; // bypass blueslip error
|
||||
obj.length = 1; // bypass blueslip error
|
||||
|
||||
return obj;
|
||||
},
|
||||
|
@@ -174,7 +174,7 @@ run_test("expanding_sidebar", () => {
|
||||
popovers.hide_all = () => {
|
||||
events.push("popovers.hide_all");
|
||||
};
|
||||
stream_popover.show_streamlist_sidebar = () => {
|
||||
stream_popover.show_streamlist_sidebar = () => {
|
||||
events.push("stream_popover.show_streamlist_sidebar");
|
||||
};
|
||||
|
||||
|
@@ -77,7 +77,7 @@ run_test("render_now_returns_year_with_year_boundary", () => {
|
||||
|
||||
run_test("render_date_renders_time_html", () => {
|
||||
const today = new XDate(1555091573000); // Friday 4/12/2019 5:52:53 PM (UTC+0)
|
||||
const message_time = today.clone();
|
||||
const message_time = today.clone();
|
||||
const expected_html = i18n.t("Today");
|
||||
|
||||
const attrs = {};
|
||||
|
@@ -171,7 +171,7 @@ run_test("upload_files", () => {
|
||||
hide_upload_status_called = true;
|
||||
assert(config.mode, "compose");
|
||||
};
|
||||
const config = {mode: "compose"};
|
||||
const config = {mode: "compose"};
|
||||
$("#compose-send-button").attr("disabled", false);
|
||||
upload.upload_files(uppy, config, []);
|
||||
assert.equal($("#compose-send-button").attr("disabled"), false);
|
||||
|
@@ -59,7 +59,7 @@ async function realm_creation_tests(page) {
|
||||
|
||||
// Check if realm is created and user is logged in by checking if
|
||||
// element of id `lightbox_overlay` exists.
|
||||
await page.waitForSelector("#lightbox_overlay"); // if element doesn't exist,timeout error raises
|
||||
await page.waitForSelector("#lightbox_overlay"); // if element doesn't exist,timeout error raises
|
||||
}
|
||||
|
||||
common.run_test(realm_creation_tests);
|
||||
|
@@ -50,7 +50,7 @@ function apply_color(input_string, changes) {
|
||||
* directions to add appropriate color to the lines that they annotate.
|
||||
*/
|
||||
function parse_questionmark_line(questionmark_line) {
|
||||
let current_sequence = ""; // Either "^", "-", "+", or ""
|
||||
let current_sequence = ""; // Either "^", "-", "+", or ""
|
||||
let beginning_index = 0;
|
||||
let index = 0;
|
||||
|
||||
|
@@ -507,7 +507,7 @@ exports.make_zjquery = function (opts) {
|
||||
return elems.get(selector);
|
||||
};
|
||||
|
||||
zjquery.create = function (name) {
|
||||
zjquery.create = function (name) {
|
||||
assert(!elems.has(name),
|
||||
"You already created an object with this name!!");
|
||||
const elem = new_elem(name);
|
||||
|
@@ -6,8 +6,8 @@ exports.create_ajax_request = function (url, form_name, stripe_token = null, num
|
||||
const form_error = "#" + form_name + "-error";
|
||||
const form_loading = "#" + form_name + "-loading";
|
||||
|
||||
const zulip_limited_section = "#zulip-limited-section";
|
||||
const free_trial_alert_message = "#free-trial-alert-message";
|
||||
const zulip_limited_section = "#zulip-limited-section";
|
||||
const free_trial_alert_message = "#free-trial-alert-message";
|
||||
|
||||
loading.make_indicator($(form_loading_indicator),
|
||||
{text: "Processing ...", abs_positioned: true});
|
||||
|
@@ -7,7 +7,7 @@ const render_buddy_list_tooltip_content = require("../templates/buddy_list_toolt
|
||||
|
||||
function convert_enter_to_click(e) {
|
||||
const key = e.which;
|
||||
if (key === 13) { // enter
|
||||
if (key === 13) { // enter
|
||||
$(e.currentTarget).click();
|
||||
}
|
||||
}
|
||||
|
@@ -806,7 +806,7 @@ exports.render_and_show_preview = function (preview_spinner, preview_content_box
|
||||
if (content.length === 0) {
|
||||
show_preview(i18n.t("Nothing to preview"));
|
||||
} else {
|
||||
if (markdown.contains_backend_only_syntax(content)) {
|
||||
if (markdown.contains_backend_only_syntax(content)) {
|
||||
const spinner = preview_spinner.expectOne();
|
||||
loading.make_indicator(spinner);
|
||||
} else {
|
||||
@@ -1131,7 +1131,7 @@ exports.initialize = function () {
|
||||
},
|
||||
});
|
||||
} else {
|
||||
video_call_link = page_params.jitsi_server_url + "/" + video_call_id;
|
||||
video_call_link = page_params.jitsi_server_url + "/" + video_call_id;
|
||||
insert_video_call_url(video_call_link, target_textarea);
|
||||
}
|
||||
});
|
||||
|
@@ -2,7 +2,7 @@ const util = require("./util");
|
||||
let focused_recipient;
|
||||
let normal_display = false;
|
||||
|
||||
exports.should_fade_message = function (message) {
|
||||
exports.should_fade_message = function (message) {
|
||||
return !util.same_recipient(focused_recipient, message);
|
||||
};
|
||||
|
||||
|
@@ -36,8 +36,8 @@ function get_or_set(fieldname, keep_leading_whitespace) {
|
||||
}
|
||||
|
||||
// TODO: Break out setters and getter into their own functions.
|
||||
exports.stream_name = get_or_set("stream_message_recipient_stream");
|
||||
exports.topic = get_or_set("stream_message_recipient_topic");
|
||||
exports.stream_name = get_or_set("stream_message_recipient_stream");
|
||||
exports.topic = get_or_set("stream_message_recipient_topic");
|
||||
// We can't trim leading whitespace in `compose_textarea` because
|
||||
// of the indented syntax for multi-line code blocks.
|
||||
exports.message_content = get_or_set("compose-textarea", true);
|
||||
|
@@ -174,7 +174,7 @@ function handle_keydown(e) {
|
||||
}
|
||||
|
||||
const on_stream = target_sel === "#stream_message_recipient_stream";
|
||||
const on_topic = target_sel === "#stream_message_recipient_topic";
|
||||
const on_topic = target_sel === "#stream_message_recipient_topic";
|
||||
const on_pm = target_sel === "#private_message_recipient";
|
||||
const on_compose = target_sel === "#compose-textarea";
|
||||
|
||||
@@ -709,7 +709,7 @@ exports.get_candidates = function (query) {
|
||||
if (this.options.completions.topic) {
|
||||
// Stream regex modified from marked.js
|
||||
// Matches '#**stream name** >' at the end of a split.
|
||||
const stream_regex = /#\*\*([^*>]+)\*\*\s?>$/;
|
||||
const stream_regex = /#\*\*([^*>]+)\*\*\s?>$/;
|
||||
const should_jump_inside_typeahead = stream_regex.test(split[0]);
|
||||
if (should_jump_inside_typeahead) {
|
||||
this.completing = "topic_jump";
|
||||
@@ -892,7 +892,7 @@ exports.content_typeahead_selected = function (item, event) {
|
||||
|
||||
const on_timestamp_selection = (val) => {
|
||||
const datestr = val;
|
||||
beginning = beginning.substring(0, beginning.lastIndexOf("<time")) + `<time:${datestr}> `;
|
||||
beginning = beginning.substring(0, beginning.lastIndexOf("<time")) + `<time:${datestr}> `;
|
||||
if (rest.startsWith(">")) {
|
||||
rest = rest.slice(1);
|
||||
}
|
||||
|
@@ -204,7 +204,7 @@ exports.restore_draft = function (draft_id) {
|
||||
const DRAFT_LIFETIME = 30;
|
||||
|
||||
exports.remove_old_drafts = function () {
|
||||
const old_date = new Date().setDate(new Date().getDate() - DRAFT_LIFETIME);
|
||||
const old_date = new Date().setDate(new Date().getDate() - DRAFT_LIFETIME);
|
||||
const drafts = draft_model.get();
|
||||
for (const [id, draft] of Object.entries(drafts)) {
|
||||
if (draft.updatedAt < old_date) {
|
||||
|
@@ -213,7 +213,7 @@ function filter_emojis() {
|
||||
const match = search_terms.every((search_term) => alias.includes(search_term));
|
||||
if (match) {
|
||||
search_results.push({...emoji_dict, emoji_name: alias});
|
||||
break; // We only need the first matching alias per emoji.
|
||||
break; // We only need the first matching alias per emoji.
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -353,7 +353,7 @@ function get_next_emoji_coordinates(move_by) {
|
||||
if (move_by === -6) {
|
||||
max_len = get_max_index(next_section);
|
||||
const prev_multiple = round_off_to_previous_multiple(max_len, 6);
|
||||
next_index = prev_multiple + current_index;
|
||||
next_index = prev_multiple + current_index;
|
||||
next_index = next_index >= max_len
|
||||
? prev_multiple + current_index - 6
|
||||
: next_index;
|
||||
@@ -505,9 +505,9 @@ function process_keypress(e) {
|
||||
const old_query = emoji_filter.val();
|
||||
let new_query = "";
|
||||
|
||||
if (pressed_key === 8) { // Handles backspace.
|
||||
if (pressed_key === 8) { // Handles backspace.
|
||||
new_query = old_query.slice(0, -1);
|
||||
} else { // Handles any printable character.
|
||||
} else { // Handles any printable character.
|
||||
const key_str = String.fromCharCode(e.which);
|
||||
new_query = old_query + key_str;
|
||||
}
|
||||
|
@@ -5,19 +5,19 @@
|
||||
// auto-completing code blocks missing a trailing close.
|
||||
|
||||
// See backend fenced_code.py:71 for associated regexp
|
||||
const fencestr = "^(~{3,}|`{3,})" + // Opening Fence
|
||||
"[ ]*" + // Spaces
|
||||
"(" +
|
||||
"\\{?\\.?" +
|
||||
"([a-zA-Z0-9_+-./#]*)" + // Language
|
||||
"\\}?" +
|
||||
")" +
|
||||
"[ ]*" + // Spaces
|
||||
"(" +
|
||||
"\\{?\\.?" +
|
||||
"([^~`]*)" + // Header (see fenced_code.py)
|
||||
"\\}?" +
|
||||
")" +
|
||||
const fencestr = "^(~{3,}|`{3,})" + // Opening Fence
|
||||
"[ ]*" + // Spaces
|
||||
"(" +
|
||||
"\\{?\\.?" +
|
||||
"([a-zA-Z0-9_+-./#]*)" + // Language
|
||||
"\\}?" +
|
||||
")" +
|
||||
"[ ]*" + // Spaces
|
||||
"(" +
|
||||
"\\{?\\.?" +
|
||||
"([^~`]*)" + // Header (see fenced_code.py)
|
||||
"\\}?" +
|
||||
")" +
|
||||
"$";
|
||||
const fence_re = new RegExp(fencestr);
|
||||
|
||||
|
@@ -260,7 +260,7 @@ function decodeOperand(encoded, operator) {
|
||||
|
||||
// Parse a string into a list of operators (see below).
|
||||
Filter.parse = function (str) {
|
||||
const operators = [];
|
||||
const operators = [];
|
||||
const search_term = [];
|
||||
let negated;
|
||||
let operator;
|
||||
@@ -494,7 +494,7 @@ Filter.prototype = {
|
||||
if (!this._sub) {
|
||||
return "#";
|
||||
}
|
||||
return "/#narrow/stream/" + stream_data.name_to_slug(this.operands("stream")[0]) + "/topic/" + this.operands("topic")[0];
|
||||
return "/#narrow/stream/" + stream_data.name_to_slug(this.operands("stream")[0]) + "/topic/" + this.operands("topic")[0];
|
||||
}
|
||||
|
||||
// eliminate "complex filters"
|
||||
@@ -509,22 +509,22 @@ Filter.prototype = {
|
||||
if (!this._sub) {
|
||||
return "#";
|
||||
}
|
||||
return "/#narrow/stream/" + stream_data.name_to_slug(this.operands("stream")[0]);
|
||||
return "/#narrow/stream/" + stream_data.name_to_slug(this.operands("stream")[0]);
|
||||
case "is-private":
|
||||
return "/#narrow/is/private";
|
||||
return "/#narrow/is/private";
|
||||
case "is-starred":
|
||||
return "/#narrow/is/starred";
|
||||
return "/#narrow/is/starred";
|
||||
case "is-mentioned":
|
||||
return "/#narrow/is/mentioned";
|
||||
return "/#narrow/is/mentioned";
|
||||
case "streams-public":
|
||||
return "/#narrow/streams/public";
|
||||
return "/#narrow/streams/public";
|
||||
case "pm-with":
|
||||
// join is used to transform the array to a comma separated string
|
||||
return "/#narrow/pm-with/" + people.emails_to_slug(this.operands("pm-with").join());
|
||||
return "/#narrow/pm-with/" + people.emails_to_slug(this.operands("pm-with").join());
|
||||
// TODO: It is ambiguous how we want to handle the 'sender' case,
|
||||
// we may remove it in the future based on design decisions
|
||||
case "sender":
|
||||
return "/#narrow/sender/" + people.emails_to_slug(this.operands("sender")[0]);
|
||||
return "/#narrow/sender/" + people.emails_to_slug(this.operands("sender")[0]);
|
||||
}
|
||||
}
|
||||
|
||||
|
@@ -190,7 +190,7 @@ exports.parse_narrow = function (hash) {
|
||||
operator = operator.slice(1);
|
||||
}
|
||||
|
||||
const operand = exports.decode_operand(operator, raw_operand);
|
||||
const operand = exports.decode_operand(operator, raw_operand);
|
||||
operators.push({negated: negated, operator: operator, operand: operand});
|
||||
}
|
||||
return operators;
|
||||
|
@@ -18,7 +18,7 @@ function get_full_url(hash) {
|
||||
}
|
||||
|
||||
// Build a full URL to not have same origin problems
|
||||
const url = location.protocol + "//" + location.host + pathname + hash;
|
||||
const url = location.protocol + "//" + location.host + pathname + hash;
|
||||
return url;
|
||||
}
|
||||
|
||||
@@ -88,7 +88,7 @@ function do_hashchange_normal(from_reload) {
|
||||
return false;
|
||||
}
|
||||
const narrow_opts = {
|
||||
change_hash: false, // already set
|
||||
change_hash: false, // already set
|
||||
trigger: "hash change",
|
||||
};
|
||||
if (from_reload) {
|
||||
|
@@ -26,7 +26,7 @@ const menu_dropdown_hotkeys = [
|
||||
const keydown_shift_mappings = {
|
||||
// these can be triggered by shift + key only
|
||||
9: {name: "shift_tab", message_view_only: false}, // tab
|
||||
32: {name: "shift_spacebar", message_view_only: true}, // space bar
|
||||
32: {name: "shift_spacebar", message_view_only: true}, // space bar
|
||||
37: {name: "left_arrow", message_view_only: false}, // left arrow
|
||||
39: {name: "right_arrow", message_view_only: false}, // right arrow
|
||||
38: {name: "up_arrow", message_view_only: false}, // up arrow
|
||||
|
@@ -13,7 +13,7 @@ i18next.init({
|
||||
prefix: "__",
|
||||
suffix: "__",
|
||||
},
|
||||
returnEmptyString: false, // Empty string is not a valid translation.
|
||||
returnEmptyString: false, // Empty string is not a valid translation.
|
||||
});
|
||||
|
||||
window.i18n = i18next;
|
||||
|
@@ -42,7 +42,7 @@ exports.send_read = (function () {
|
||||
start = _.throttle(server_request, 1000);
|
||||
|
||||
on_success = function on_success(data) {
|
||||
if (data === undefined || data.messages === undefined) {
|
||||
if (data === undefined || data.messages === undefined) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@@ -121,7 +121,7 @@ exports.MessageList.prototype = {
|
||||
return this.data.can_mark_messages_read();
|
||||
},
|
||||
|
||||
clear: function MessageList_clear(opts) {
|
||||
clear: function MessageList_clear(opts) {
|
||||
opts = {clear_selected_id: true, ...opts};
|
||||
|
||||
this.data.clear();
|
||||
|
@@ -357,7 +357,7 @@ MessageListData.prototype = {
|
||||
}
|
||||
|
||||
const start_idx = this._lower_bound(start);
|
||||
const end_idx = this._lower_bound(end);
|
||||
const end_idx = this._lower_bound(end);
|
||||
return this._items.slice(start_idx, end_idx + 1);
|
||||
},
|
||||
|
||||
|
@@ -259,7 +259,7 @@ MessageListView.prototype = {
|
||||
const message_reactions = reactions.get_message_reactions(message_container.msg);
|
||||
message_container.msg.message_reactions = message_reactions;
|
||||
message_container.include_recipient = false;
|
||||
message_container.include_footer = false;
|
||||
message_container.include_footer = false;
|
||||
|
||||
if (same_recipient(prev, message_container) && self.collapse_messages &&
|
||||
prev.msg.historical === message_container.msg.historical) {
|
||||
|
@@ -99,7 +99,7 @@ exports.set_message_booleans = function (message) {
|
||||
message.historical = convert_flag("historical");
|
||||
message.starred = convert_flag("starred");
|
||||
message.mentioned = convert_flag("mentioned") || convert_flag("wildcard_mentioned");
|
||||
message.mentioned_me_directly = convert_flag("mentioned");
|
||||
message.mentioned_me_directly = convert_flag("mentioned");
|
||||
message.collapsed = convert_flag("collapsed");
|
||||
message.alerted = convert_flag("has_alert_word");
|
||||
|
||||
@@ -133,7 +133,7 @@ exports.update_booleans = function (message, flags) {
|
||||
}
|
||||
|
||||
message.mentioned = convert_flag("mentioned") || convert_flag("wildcard_mentioned");
|
||||
message.mentioned_me_directly = convert_flag("mentioned");
|
||||
message.mentioned_me_directly = convert_flag("mentioned");
|
||||
message.alerted = convert_flag("has_alert_word");
|
||||
};
|
||||
|
||||
|
@@ -396,7 +396,7 @@ exports.keep_pointer_in_view = function () {
|
||||
// return true only if we make an actual adjustment, so
|
||||
// that we know to short circuit the other direction
|
||||
if (in_view(next_row)) {
|
||||
return false; // try other side
|
||||
return false; // try other side
|
||||
}
|
||||
while (!in_view(next_row)) {
|
||||
candidate = get_next_row(next_row);
|
||||
|
@@ -205,7 +205,7 @@ exports.activate = function (raw_operators, opts) {
|
||||
// Save how far from the pointer the top of the message list was.
|
||||
exports.save_pre_narrow_offset_for_reload();
|
||||
|
||||
let msg_data = new MessageListData({
|
||||
let msg_data = new MessageListData({
|
||||
filter: narrow_state.filter(),
|
||||
muting_enabled: muting_enabled,
|
||||
});
|
||||
|
@@ -45,7 +45,7 @@ exports.search_string = function () {
|
||||
// Collect operators which appear only once into an object,
|
||||
// and discard those which appear more than once.
|
||||
function collect_single(operators) {
|
||||
const seen = new Map();
|
||||
const seen = new Map();
|
||||
const result = new Map();
|
||||
|
||||
for (const elem of operators) {
|
||||
|
@@ -1,5 +1,5 @@
|
||||
const util = require("./util");
|
||||
require("unorm"); // String.prototype.normalize polyfill for IE11
|
||||
require("unorm"); // String.prototype.normalize polyfill for IE11
|
||||
const FoldDict = require("./fold_dict").FoldDict;
|
||||
const typeahead = require("../shared/js/typeahead");
|
||||
const settings_data = require("./settings_data");
|
||||
|
@@ -256,7 +256,7 @@ function show_user_info_popover(element, user, message) {
|
||||
return;
|
||||
}
|
||||
|
||||
const is_sender_popover = message.sender_id === user.user_id;
|
||||
const is_sender_popover = message.sender_id === user.user_id;
|
||||
render_user_info_popover(user, elt, is_sender_popover, "respond_personal_button",
|
||||
"message-info-popover", "right");
|
||||
|
||||
|
@@ -91,9 +91,9 @@ function set_results(response) {
|
||||
responses.forEach((response) => {
|
||||
if (response.fixture_name !== undefined) {
|
||||
data += "Fixture: " + response.fixture_name;
|
||||
data += "\nStatus Code: " + response.status_code;
|
||||
data += "\nStatus Code: " + response.status_code;
|
||||
} else {
|
||||
data += "Status Code: " + response.status_code;
|
||||
data += "Status Code: " + response.status_code;
|
||||
}
|
||||
data += "\nResponse: " + response.message + "\n\n";
|
||||
});
|
||||
|
@@ -271,8 +271,8 @@ exports.initiate = function (options) {
|
||||
let idle_control;
|
||||
const random_variance = util.random_int(0, 1000 * 60 * 5);
|
||||
const unconditional_timeout = 1000 * 60 * 30 + random_variance;
|
||||
const composing_idle_timeout = 1000 * 60 * 7 + random_variance;
|
||||
const basic_idle_timeout = 1000 * 60 * 1 + random_variance;
|
||||
const composing_idle_timeout = 1000 * 60 * 7 + random_variance;
|
||||
const basic_idle_timeout = 1000 * 60 * 1 + random_variance;
|
||||
let compose_started_handler;
|
||||
|
||||
function reload_from_idle() {
|
||||
|
@@ -385,7 +385,7 @@ exports.sync_realm_settings = function (property) {
|
||||
} else if (property === "invite_required" || property === "invite_by_admins_only") {
|
||||
property = "user_invite_restriction";
|
||||
}
|
||||
const element = $("#id_realm_" + property);
|
||||
const element = $("#id_realm_" + property);
|
||||
if (element.length) {
|
||||
discard_property_element_changes(element);
|
||||
}
|
||||
@@ -967,7 +967,7 @@ exports.build_page = function () {
|
||||
form_data.append("night", JSON.stringify(night));
|
||||
}
|
||||
const spinner = $(`${widget} .upload-spinner-background`).expectOne();
|
||||
const upload_text = $(`${widget} .settings-page-upload-text`).expectOne();
|
||||
const upload_text = $(`${widget} .settings-page-upload-text`).expectOne();
|
||||
const delete_button = $(`${widget} .settings-page-delete-button`).expectOne();
|
||||
const error_field = $(`${widget} .image_file_input_error`).expectOne();
|
||||
realm_icon_logo_upload_start(spinner, upload_text, delete_button);
|
||||
|
@@ -340,8 +340,8 @@ exports.do_populate_profile_fields = function (profile_fields_data) {
|
||||
// We should only call this internally or from tests.
|
||||
const profile_fields_table = $("#admin_profile_fields_table").expectOne();
|
||||
|
||||
profile_fields_table.find("tr.profile-field-row").remove(); // Clear all rows.
|
||||
profile_fields_table.find("tr.profile-field-form").remove(); // Clear all rows.
|
||||
profile_fields_table.find("tr.profile-field-row").remove(); // Clear all rows.
|
||||
profile_fields_table.find("tr.profile-field-form").remove(); // Clear all rows.
|
||||
order = [];
|
||||
|
||||
for (const profile_field of profile_fields_data) {
|
||||
|
@@ -433,7 +433,7 @@ function get_human_profile_data(fields_user_pills) {
|
||||
}
|
||||
});
|
||||
// Append user type field values also
|
||||
for (const [field_id, field_pills] of fields_user_pills) {
|
||||
for (const [field_id, field_pills] of fields_user_pills) {
|
||||
if (field_pills) {
|
||||
const user_ids = user_pill.get_user_ids(field_pills);
|
||||
new_profile_data.push({
|
||||
|
@@ -311,7 +311,7 @@ exports.create_handlers_for_users = function (container) {
|
||||
// 'Check all' and 'Uncheck all' visible users
|
||||
container.on("click", ".subs_set_all_users", (e) => {
|
||||
$("#user-checkboxes .checkbox").each((idx, li) => {
|
||||
if (li.style.display !== "none") {
|
||||
if (li.style.display !== "none") {
|
||||
$(li.firstElementChild).prop("checked", true);
|
||||
}
|
||||
});
|
||||
|
@@ -458,7 +458,7 @@ exports.update_stream_privacy = function (sub, values) {
|
||||
sub.history_public_to_subscribers = values.history_public_to_subscribers;
|
||||
};
|
||||
|
||||
exports.update_message_retention_setting = function (sub, message_retention_days) {
|
||||
exports.update_message_retention_setting = function (sub, message_retention_days) {
|
||||
sub.message_retention_days = message_retention_days;
|
||||
};
|
||||
|
||||
@@ -845,7 +845,7 @@ exports.sort_for_stream_settings = function (stream_ids, order) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
function by_stream_name(id_a, id_b) {
|
||||
function by_stream_name(id_a, id_b) {
|
||||
const stream_a_name = name(id_a);
|
||||
const stream_b_name = name(id_b);
|
||||
return String.prototype.localeCompare.call(stream_a_name, stream_b_name);
|
||||
|
@@ -69,7 +69,7 @@ exports.get_retention_policy_text_for_subscription_type = function (sub) {
|
||||
|
||||
// If we are deleting messages, even if it's the organization
|
||||
// default, it's worth commenting on the policy.
|
||||
if (message_retention_days === null) {
|
||||
if (message_retention_days === null) {
|
||||
message_retention_days = page_params.realm_message_retention_days;
|
||||
}
|
||||
|
||||
|
@@ -353,7 +353,7 @@ exports.refresh_pinned_or_unpinned_stream = function (sub) {
|
||||
}
|
||||
};
|
||||
|
||||
exports.get_sidebar_stream_topic_info = function (filter) {
|
||||
exports.get_sidebar_stream_topic_info = function (filter) {
|
||||
const result = {
|
||||
stream_id: undefined,
|
||||
topic_selected: false,
|
||||
|
@@ -60,7 +60,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") {
|
||||
if (typeof current_date === "undefined") {
|
||||
current_date = new XDate();
|
||||
}
|
||||
|
||||
|
@@ -197,7 +197,7 @@ exports.get_next_topic = function (curr_stream, curr_topic) {
|
||||
if (!stream_data.is_stream_muted_by_name(stream_name)) {
|
||||
return true;
|
||||
}
|
||||
if (stream_name === curr_stream) {
|
||||
if (stream_name === curr_stream) {
|
||||
// We can use n within a muted stream if we are
|
||||
// currently narrowed to it.
|
||||
return true;
|
||||
|
@@ -74,7 +74,7 @@ exports.reply_message = function (opts) {
|
||||
content = mention + " " + content;
|
||||
|
||||
reply.type = "stream";
|
||||
reply.to = stream;
|
||||
reply.to = stream;
|
||||
reply.content = content;
|
||||
reply.topic = message.topic;
|
||||
|
||||
|
@@ -233,7 +233,7 @@ exports.unread_topic_counter = (function () {
|
||||
self.get_counts = function () {
|
||||
const res = {};
|
||||
res.stream_unread_messages = 0;
|
||||
res.stream_count = new Map(); // hash by stream_id -> count
|
||||
res.stream_count = new Map(); // hash by stream_id -> count
|
||||
for (const [stream_id, per_stream_bucketer] of bucketer) {
|
||||
|
||||
// We track unread counts for streams that may be currently
|
||||
|
@@ -51,8 +51,8 @@ async function run() {
|
||||
await page.waitForSelector(messageSelector);
|
||||
// remove unread marker and don't select message
|
||||
const marker = `#zfilt${options.messageId} .unread_marker`;
|
||||
await page.evaluate((sel) => $(sel).remove(), marker); // eslint-disable-line no-undef
|
||||
await page.evaluate(() => navigate.up()); // eslint-disable-line no-undef
|
||||
await page.evaluate((sel) => $(sel).remove(), marker); // eslint-disable-line no-undef
|
||||
await page.evaluate(() => navigate.up()); // eslint-disable-line no-undef
|
||||
const messageBox = await page.$(messageSelector);
|
||||
const messageGroup = (await messageBox.$x(".."))[0];
|
||||
// Compute screenshot area, with some padding around the message group
|
||||
|
@@ -30,7 +30,7 @@ export default (env?: string): webpack.Configuration[] => {
|
||||
{
|
||||
loader: "css-loader",
|
||||
options: {
|
||||
url: false, // webfonts-loader generates public relative URLs
|
||||
url: false, // webfonts-loader generates public relative URLs
|
||||
},
|
||||
},
|
||||
{
|
||||
|
Reference in New Issue
Block a user