mirror of https://github.com/zulip/zulip.git
eslint: Enable `conditionalAssign` config of no-trailing-spaces rule.
This commit is contained in:
parent
dcb6254a4e
commit
80a2d5bc59
|
@ -280,12 +280,7 @@
|
||||||
"no-eq-null": 2,
|
"no-eq-null": 2,
|
||||||
"no-eval": 2,
|
"no-eval": 2,
|
||||||
"no-ex-assign": 2,
|
"no-ex-assign": 2,
|
||||||
"no-extra-parens": ["error", "all",
|
"no-extra-parens": ["error", "all"],
|
||||||
{
|
|
||||||
"conditionalAssign": false,
|
|
||||||
"nestedBinaryExpressions": false
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"no-extra-semi": 2,
|
"no-extra-semi": 2,
|
||||||
"no-fallthrough": 2,
|
"no-fallthrough": 2,
|
||||||
"no-floating-decimal": 2,
|
"no-floating-decimal": 2,
|
||||||
|
|
|
@ -319,7 +319,7 @@ exports.then_send_many = function (msgs) {
|
||||||
exports.wait_for_receive = function (step) {
|
exports.wait_for_receive = function (step) {
|
||||||
// Wait until the last send or get_events result was more than 1000 ms ago.
|
// Wait until the last send or get_events result was more than 1000 ms ago.
|
||||||
casper.waitFor(function () {
|
casper.waitFor(function () {
|
||||||
return (timestamp() - last_send_or_update) > 1000;
|
return timestamp() - last_send_or_update > 1000;
|
||||||
}, step);
|
}, step);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -401,15 +401,15 @@ exports.make_zjquery = function (opts) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var valid_selector =
|
var valid_selector =
|
||||||
('<#.'.indexOf(selector[0]) >= 0) ||
|
'<#.'.indexOf(selector[0]) >= 0 ||
|
||||||
(selector === 'window-stub') ||
|
selector === 'window-stub' ||
|
||||||
(selector === 'document-stub') ||
|
selector === 'document-stub' ||
|
||||||
(selector === 'body') ||
|
selector === 'body' ||
|
||||||
(selector === 'html') ||
|
selector === 'html' ||
|
||||||
selector.location ||
|
selector.location ||
|
||||||
(selector.indexOf('#') >= 0) ||
|
selector.indexOf('#') >= 0 ||
|
||||||
(selector.indexOf('.') >= 0) ||
|
selector.indexOf('.') >= 0 ||
|
||||||
(selector.indexOf('[') >= 0 && selector.indexOf(']') >= selector.indexOf('['));
|
selector.indexOf('[') >= 0 && selector.indexOf(']') >= selector.indexOf('[');
|
||||||
|
|
||||||
assert(valid_selector,
|
assert(valid_selector,
|
||||||
'Invalid selector: ' + selector +
|
'Invalid selector: ' + selector +
|
||||||
|
|
|
@ -122,7 +122,7 @@ exports.process_loaded_messages = function (messages) {
|
||||||
if (huddle_string) {
|
if (huddle_string) {
|
||||||
var old_timestamp = huddle_timestamps.get(huddle_string);
|
var old_timestamp = huddle_timestamps.get(huddle_string);
|
||||||
|
|
||||||
if (!old_timestamp || (old_timestamp < message.timestamp)) {
|
if (!old_timestamp || old_timestamp < message.timestamp) {
|
||||||
huddle_timestamps.set(huddle_string, message.timestamp);
|
huddle_timestamps.set(huddle_string, message.timestamp);
|
||||||
need_resize = true;
|
need_resize = true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,8 +29,8 @@ function bytes_to_size(bytes, kb_with_1024_bytes) {
|
||||||
}
|
}
|
||||||
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(kb_size)), 10);
|
var i = parseInt(Math.floor(Math.log(bytes) / Math.log(kb_size)), 10);
|
||||||
var size = Math.round(bytes / Math.pow(kb_size, i));
|
var size = Math.round(bytes / Math.pow(kb_size, i));
|
||||||
if ((i > 0) && (size < 10)) {
|
if (i > 0 && size < 10) {
|
||||||
size = Math.round((bytes / Math.pow(kb_size, i)) * 10) / 10;
|
size = Math.round(bytes / Math.pow(kb_size, i) * 10) / 10;
|
||||||
}
|
}
|
||||||
return size + ' ' + sizes[i];
|
return size + ' ' + sizes[i];
|
||||||
}
|
}
|
||||||
|
|
|
@ -58,7 +58,7 @@ exports.initialize = function () {
|
||||||
return target.is("a") || target.is("img.message_inline_image") || target.is("img.twitter-avatar") ||
|
return target.is("a") || target.is("img.message_inline_image") || target.is("img.twitter-avatar") ||
|
||||||
target.is("div.message_length_controller") || target.is("textarea") || target.is("input") ||
|
target.is("div.message_length_controller") || target.is("textarea") || target.is("input") ||
|
||||||
target.is("i.edit_content_button") ||
|
target.is("i.edit_content_button") ||
|
||||||
(target.is(".highlight") && target.parent().is("a"));
|
target.is(".highlight") && target.parent().is("a");
|
||||||
}
|
}
|
||||||
|
|
||||||
function initialize_long_tap() {
|
function initialize_long_tap() {
|
||||||
|
@ -121,7 +121,7 @@ exports.initialize = function () {
|
||||||
// work nearly perfectly. Once we no longer need to support
|
// work nearly perfectly. Once we no longer need to support
|
||||||
// older browsers, we may be able to use the window.selection
|
// older browsers, we may be able to use the window.selection
|
||||||
// API instead.
|
// API instead.
|
||||||
if ((drag.val < 5 && drag.time < 150) || drag.val < 2) {
|
if (drag.val < 5 && drag.time < 150 || drag.val < 2) {
|
||||||
var row = $(this).closest(".message_row");
|
var row = $(this).closest(".message_row");
|
||||||
var id = rows.id(row);
|
var id = rows.id(row);
|
||||||
|
|
||||||
|
|
|
@ -26,8 +26,8 @@ exports.rgb_luminance = function (channel) {
|
||||||
// http://en.wikipedia.org/wiki/Lab_color_space#Forward_transformation
|
// http://en.wikipedia.org/wiki/Lab_color_space#Forward_transformation
|
||||||
exports.luminance_to_lightness = function (luminance) {
|
exports.luminance_to_lightness = function (luminance) {
|
||||||
var v;
|
var v;
|
||||||
if (luminance <= (216 / 24389)) {
|
if (luminance <= 216 / 24389) {
|
||||||
v = (841 / 108) * luminance + (4 / 29);
|
v = 841 / 108 * luminance + 4 / 29;
|
||||||
} else {
|
} else {
|
||||||
v = Math.pow(luminance, 1 / 3);
|
v = Math.pow(luminance, 1 / 3);
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,7 +48,7 @@ exports.password_quality = function (password, bar, password_field) {
|
||||||
|
|
||||||
// The bar bottoms out at 10% so there's always something
|
// The bar bottoms out at 10% so there's always something
|
||||||
// for the user to see.
|
// for the user to see.
|
||||||
bar.width(((90 * bar_progress) + 10) + '%')
|
bar.width(90 * bar_progress + 10 + '%')
|
||||||
.removeClass('bar-success bar-danger')
|
.removeClass('bar-success bar-danger')
|
||||||
.addClass(acceptable ? 'bar-success' : 'bar-danger');
|
.addClass(acceptable ? 'bar-success' : 'bar-danger');
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,8 +33,8 @@ function get_focus_area(msg_type, opts) {
|
||||||
// Set focus to "Topic" when narrowed to a stream+topic and "New topic" button clicked.
|
// Set focus to "Topic" when narrowed to a stream+topic and "New topic" button clicked.
|
||||||
if (msg_type === 'stream' && opts.stream && !opts.subject) {
|
if (msg_type === 'stream' && opts.stream && !opts.subject) {
|
||||||
return 'subject';
|
return 'subject';
|
||||||
} else if ((msg_type === 'stream' && opts.stream)
|
} else if (msg_type === 'stream' && opts.stream
|
||||||
|| (msg_type === 'private' && opts.private_message_recipient)) {
|
|| msg_type === 'private' && opts.private_message_recipient) {
|
||||||
if (opts.trigger === "new topic button") {
|
if (opts.trigger === "new topic button") {
|
||||||
return 'subject';
|
return 'subject';
|
||||||
}
|
}
|
||||||
|
@ -181,12 +181,12 @@ function fill_in_opts_from_current_narrowed_view(msg_type, opts) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function same_recipient_as_before(msg_type, opts) {
|
function same_recipient_as_before(msg_type, opts) {
|
||||||
return (compose_state.get_message_type() === msg_type) &&
|
return compose_state.get_message_type() === msg_type &&
|
||||||
((msg_type === "stream" &&
|
(msg_type === "stream" &&
|
||||||
opts.stream === compose_state.stream_name() &&
|
opts.stream === compose_state.stream_name() &&
|
||||||
opts.subject === compose_state.subject()) ||
|
opts.subject === compose_state.subject() ||
|
||||||
(msg_type === "private" &&
|
msg_type === "private" &&
|
||||||
opts.private_message_recipient === compose_state.recipient()));
|
opts.private_message_recipient === compose_state.recipient());
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.start = function (msg_type, opts) {
|
exports.start = function (msg_type, opts) {
|
||||||
|
@ -202,9 +202,9 @@ exports.start = function (msg_type, opts) {
|
||||||
// If we are invoked by a compose hotkey (c or x) or new topic button
|
// If we are invoked by a compose hotkey (c or x) or new topic button
|
||||||
// or sidebar stream actions (in stream popover), do not assume that we know what
|
// or sidebar stream actions (in stream popover), do not assume that we know what
|
||||||
// the message's topic or PM recipient should be.
|
// the message's topic or PM recipient should be.
|
||||||
if ((opts.trigger === "compose_hotkey") ||
|
if (opts.trigger === "compose_hotkey" ||
|
||||||
(opts.trigger === "new topic button") ||
|
opts.trigger === "new topic button" ||
|
||||||
(opts.trigger === "sidebar stream actions")) {
|
opts.trigger === "sidebar stream actions") {
|
||||||
opts.subject = '';
|
opts.subject = '';
|
||||||
opts.private_message_recipient = '';
|
opts.private_message_recipient = '';
|
||||||
}
|
}
|
||||||
|
@ -280,7 +280,7 @@ exports.respond_to_message = function (opts) {
|
||||||
var first_operator = first_term.operator;
|
var first_operator = first_term.operator;
|
||||||
var first_operand = first_term.operand;
|
var first_operand = first_term.operand;
|
||||||
|
|
||||||
if ((first_operator === "stream") && !stream_data.is_subscribed(first_operand)) {
|
if (first_operator === "stream" && !stream_data.is_subscribed(first_operand)) {
|
||||||
compose.nonexistent_stream_reply_error();
|
compose.nonexistent_stream_reply_error();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ exports.autosize_textarea = function () {
|
||||||
|
|
||||||
exports.smart_insert = function (textarea, syntax) {
|
exports.smart_insert = function (textarea, syntax) {
|
||||||
function is_space(c) {
|
function is_space(c) {
|
||||||
return (c === ' ') || (c === '\t') || (c === '\n');
|
return c === ' ' || c === '\t' || c === '\n';
|
||||||
}
|
}
|
||||||
|
|
||||||
var pos = textarea.caret();
|
var pos = textarea.caret();
|
||||||
|
|
|
@ -114,7 +114,7 @@ var nextFocus = false;
|
||||||
function handle_keydown(e) {
|
function handle_keydown(e) {
|
||||||
var code = e.keyCode || e.which;
|
var code = e.keyCode || e.which;
|
||||||
|
|
||||||
if (code === 13 || (code === 9 && !e.shiftKey)) { // Enter key or tab key
|
if (code === 13 || code === 9 && !e.shiftKey) { // Enter key or tab key
|
||||||
if (e.target.id === "stream" || e.target.id === "subject" || e.target.id === "private_message_recipient") {
|
if (e.target.id === "stream" || e.target.id === "subject" || e.target.id === "private_message_recipient") {
|
||||||
// For enter, prevent the form from submitting
|
// For enter, prevent the form from submitting
|
||||||
// For tab, prevent the focus from changing again
|
// For tab, prevent the focus from changing again
|
||||||
|
@ -228,7 +228,7 @@ function handle_keydown(e) {
|
||||||
|
|
||||||
function handle_keyup(e) {
|
function handle_keyup(e) {
|
||||||
var code = e.keyCode || e.which;
|
var code = e.keyCode || e.which;
|
||||||
if (code === 13 || (code === 9 && !e.shiftKey)) { // Enter key or tab key
|
if (code === 13 || code === 9 && !e.shiftKey) { // Enter key or tab key
|
||||||
if (nextFocus) {
|
if (nextFocus) {
|
||||||
ui_util.focus_on(nextFocus);
|
ui_util.focus_on(nextFocus);
|
||||||
nextFocus = false;
|
nextFocus = false;
|
||||||
|
|
|
@ -64,7 +64,7 @@ var draft_model = (function () {
|
||||||
exports.draft_model = draft_model;
|
exports.draft_model = draft_model;
|
||||||
|
|
||||||
exports.snapshot_message = function () {
|
exports.snapshot_message = function () {
|
||||||
if (!compose_state.composing() || (compose_state.message_content() === "")) {
|
if (!compose_state.composing() || compose_state.message_content() === "") {
|
||||||
// If you aren't in the middle of composing the body of a
|
// If you aren't in the middle of composing the body of a
|
||||||
// message, don't try to snapshot.
|
// message, don't try to snapshot.
|
||||||
return;
|
return;
|
||||||
|
@ -126,11 +126,11 @@ exports.restore_draft = function (draft_id) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var draft_copy = _.extend({}, draft);
|
var draft_copy = _.extend({}, draft);
|
||||||
if ((draft_copy.type === "stream" &&
|
if (draft_copy.type === "stream" &&
|
||||||
draft_copy.stream.length > 0 &&
|
draft_copy.stream.length > 0 &&
|
||||||
draft_copy.subject.length > 0) ||
|
draft_copy.subject.length > 0 ||
|
||||||
(draft_copy.type === "private" &&
|
draft_copy.type === "private" &&
|
||||||
draft_copy.reply_to.length > 0)) {
|
draft_copy.reply_to.length > 0) {
|
||||||
draft_copy = _.extend({replying_to_message: draft_copy},
|
draft_copy = _.extend({replying_to_message: draft_copy},
|
||||||
draft_copy);
|
draft_copy);
|
||||||
}
|
}
|
||||||
|
|
|
@ -274,7 +274,7 @@ function get_alias_to_be_used(message_id, emoji_name) {
|
||||||
}
|
}
|
||||||
var user_id = page_params.user_id;
|
var user_id = page_params.user_id;
|
||||||
var reaction = _.find(message.reactions, function (reaction) {
|
var reaction = _.find(message.reactions, function (reaction) {
|
||||||
return (reaction.user.id === user_id) && _.contains(aliases, reaction.emoji_name);
|
return reaction.user.id === user_id && _.contains(aliases, reaction.emoji_name);
|
||||||
});
|
});
|
||||||
if (reaction) {
|
if (reaction) {
|
||||||
return reaction.emoji_name;
|
return reaction.emoji_name;
|
||||||
|
@ -322,7 +322,7 @@ exports.toggle_selected_emoji = function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
function round_off_to_previous_multiple(number_to_round, multiple) {
|
function round_off_to_previous_multiple(number_to_round, multiple) {
|
||||||
return number_to_round - (number_to_round % multiple);
|
return number_to_round - number_to_round % multiple;
|
||||||
}
|
}
|
||||||
|
|
||||||
function reset_emoji_showcase() {
|
function reset_emoji_showcase() {
|
||||||
|
@ -445,7 +445,7 @@ exports.navigate = function (event_name) {
|
||||||
var filter_text = $(".emoji-popover-filter").val();
|
var filter_text = $(".emoji-popover-filter").val();
|
||||||
var is_cursor_at_end = $(".emoji-popover-filter").caret() === filter_text.length;
|
var is_cursor_at_end = $(".emoji-popover-filter").caret() === filter_text.length;
|
||||||
if (event_name === "down_arrow" ||
|
if (event_name === "down_arrow" ||
|
||||||
(is_cursor_at_end && event_name === "right_arrow")) {
|
is_cursor_at_end && event_name === "right_arrow") {
|
||||||
selected_emoji.focus();
|
selected_emoji.focus();
|
||||||
if (current_section === 0 && current_index < 6) {
|
if (current_section === 0 && current_index < 6) {
|
||||||
$(".emoji-popover-emoji-map").scrollTop(0);
|
$(".emoji-popover-emoji-map").scrollTop(0);
|
||||||
|
@ -459,8 +459,8 @@ exports.navigate = function (event_name) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} else if ((current_section === 0 && current_index < 6 && event_name === 'up_arrow') ||
|
} else if (current_section === 0 && current_index < 6 && event_name === 'up_arrow' ||
|
||||||
(current_section === 0 && current_index === 0 && event_name === 'left_arrow')) {
|
current_section === 0 && current_index === 0 && event_name === 'left_arrow') {
|
||||||
if (selected_emoji) {
|
if (selected_emoji) {
|
||||||
// In this case, we're move up into the reaction
|
// In this case, we're move up into the reaction
|
||||||
// filter. Here, we override the default browser
|
// filter. Here, we override the default browser
|
||||||
|
|
|
@ -36,8 +36,8 @@ function zephyr_topic_name_match(message, operand) {
|
||||||
|
|
||||||
function message_in_home(message) {
|
function message_in_home(message) {
|
||||||
if (message.type === "private" || message.mentioned ||
|
if (message.type === "private" || message.mentioned ||
|
||||||
(page_params.narrow_stream !== undefined &&
|
page_params.narrow_stream !== undefined &&
|
||||||
message.stream.toLowerCase() === page_params.narrow_stream.toLowerCase())) {
|
message.stream.toLowerCase() === page_params.narrow_stream.toLowerCase()) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -347,7 +347,7 @@ Filter.prototype = {
|
||||||
|
|
||||||
operands: function (operator) {
|
operands: function (operator) {
|
||||||
return _.chain(this._operators)
|
return _.chain(this._operators)
|
||||||
.filter(function (elem) { return !elem.negated && (elem.operator === operator); })
|
.filter(function (elem) { return !elem.negated && elem.operator === operator; })
|
||||||
.map(function (elem) { return elem.operand; })
|
.map(function (elem) { return elem.operand; })
|
||||||
.value();
|
.value();
|
||||||
},
|
},
|
||||||
|
@ -606,7 +606,7 @@ function describe_unescaped(operators) {
|
||||||
|
|
||||||
if (operators.length >= 2) {
|
if (operators.length >= 2) {
|
||||||
var is = function (term, expected) {
|
var is = function (term, expected) {
|
||||||
return (term.operator === expected) && !term.negated;
|
return term.operator === expected && !term.negated;
|
||||||
};
|
};
|
||||||
|
|
||||||
if (is(operators[0], 'stream') && is(operators[1], 'topic')) {
|
if (is(operators[0], 'stream') && is(operators[1], 'topic')) {
|
||||||
|
|
|
@ -93,7 +93,7 @@ exports.update = function () {
|
||||||
// covering up a label that already exists).
|
// covering up a label that already exists).
|
||||||
var header_height = $(current_label).find('.message_header').safeOuterHeight();
|
var header_height = $(current_label).find('.message_header').safeOuterHeight();
|
||||||
if (floating_recipient_bar_bottom <=
|
if (floating_recipient_bar_bottom <=
|
||||||
(current_label.offset().top + header_height)) {
|
current_label.offset().top + header_height) {
|
||||||
// hide floating_recipient_bar and use .temp-show-date to force display
|
// hide floating_recipient_bar and use .temp-show-date to force display
|
||||||
// of the recipient_row_date belonging to the current recipient_bar
|
// of the recipient_row_date belonging to the current recipient_bar
|
||||||
$('.recipient_row_date', current_label).addClass('temp-show-date');
|
$('.recipient_row_date', current_label).addClass('temp-show-date');
|
||||||
|
|
|
@ -12,7 +12,7 @@ exports.encodeHashComponent = function (str) {
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.encode_operand = function (operator, operand) {
|
exports.encode_operand = function (operator, operand) {
|
||||||
if ((operator === 'group-pm-with') || (operator === 'pm-with') || (operator === 'sender')) {
|
if (operator === 'group-pm-with' || operator === 'pm-with' || operator === 'sender') {
|
||||||
var slug = people.emails_to_slug(operand);
|
var slug = people.emails_to_slug(operand);
|
||||||
if (slug) {
|
if (slug) {
|
||||||
return slug;
|
return slug;
|
||||||
|
@ -39,7 +39,7 @@ exports.decodeHashComponent = function (str) {
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.decode_operand = function (operator, operand) {
|
exports.decode_operand = function (operator, operand) {
|
||||||
if ((operator === 'group-pm-with') || (operator === 'pm-with') || (operator === 'sender')) {
|
if (operator === 'group-pm-with' || operator === 'pm-with' || operator === 'sender') {
|
||||||
var emails = people.slug_to_emails(operand);
|
var emails = people.slug_to_emails(operand);
|
||||||
if (emails) {
|
if (emails) {
|
||||||
return emails;
|
return emails;
|
||||||
|
|
|
@ -112,9 +112,9 @@ function do_hashchange(from_reload) {
|
||||||
// The second case is for handling the fact that some browsers
|
// The second case is for handling the fact that some browsers
|
||||||
// automatically convert '#' to '' when you change the hash to '#'.
|
// automatically convert '#' to '' when you change the hash to '#'.
|
||||||
if (window.location.hash === expected_hash ||
|
if (window.location.hash === expected_hash ||
|
||||||
(expected_hash !== undefined &&
|
expected_hash !== undefined &&
|
||||||
window.location.hash.replace(/^#/, '') === '' &&
|
window.location.hash.replace(/^#/, '') === '' &&
|
||||||
expected_hash.replace(/^#/, '') === '')) {
|
expected_hash.replace(/^#/, '') === '') {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -519,7 +519,7 @@ exports.process_hotkey = function (e, hotkey) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((actions_dropdown_hotkeys.indexOf(event_name) !== -1) && popovers.actions_popped()) {
|
if (actions_dropdown_hotkeys.indexOf(event_name) !== -1 && popovers.actions_popped()) {
|
||||||
popovers.actions_menu_handle_keyboard(event_name);
|
popovers.actions_menu_handle_keyboard(event_name);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -97,14 +97,14 @@ function place_popover(hotspot) {
|
||||||
case TOP:
|
case TOP:
|
||||||
popover_offset = {
|
popover_offset = {
|
||||||
top: -(popover_height + arrow_offset),
|
top: -(popover_height + arrow_offset),
|
||||||
left: (el_width / 2) - (popover_width / 2),
|
left: el_width / 2 - popover_width / 2,
|
||||||
};
|
};
|
||||||
arrow_placement = 'bottom';
|
arrow_placement = 'bottom';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case LEFT:
|
case LEFT:
|
||||||
popover_offset = {
|
popover_offset = {
|
||||||
top: (el_height / 2) - (popover_height / 2),
|
top: el_height / 2 - popover_height / 2,
|
||||||
left: -(popover_width + arrow_offset),
|
left: -(popover_width + arrow_offset),
|
||||||
};
|
};
|
||||||
arrow_placement = 'right';
|
arrow_placement = 'right';
|
||||||
|
@ -113,14 +113,14 @@ function place_popover(hotspot) {
|
||||||
case BOTTOM:
|
case BOTTOM:
|
||||||
popover_offset = {
|
popover_offset = {
|
||||||
top: el_height + arrow_offset,
|
top: el_height + arrow_offset,
|
||||||
left: (el_width / 2) - (popover_width / 2),
|
left: el_width / 2 - popover_width / 2,
|
||||||
};
|
};
|
||||||
arrow_placement = 'top';
|
arrow_placement = 'top';
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case RIGHT:
|
case RIGHT:
|
||||||
popover_offset = {
|
popover_offset = {
|
||||||
top: (el_height / 2) - (popover_height / 2),
|
top: el_height / 2 - popover_height / 2,
|
||||||
left: el_width + arrow_offset,
|
left: el_width + arrow_offset,
|
||||||
};
|
};
|
||||||
arrow_placement = 'left';
|
arrow_placement = 'left';
|
||||||
|
|
|
@ -11,9 +11,9 @@ function update_subscription_checkboxes() {
|
||||||
|
|
||||||
_.each(stream_data.invite_streams(), function (value) {
|
_.each(stream_data.invite_streams(), function (value) {
|
||||||
var is_notifications_stream = value === page_params.notifications_stream;
|
var is_notifications_stream = value === page_params.notifications_stream;
|
||||||
if ((stream_data.subscribed_streams().length === 1) ||
|
if (stream_data.subscribed_streams().length === 1 ||
|
||||||
!is_notifications_stream ||
|
!is_notifications_stream ||
|
||||||
(is_notifications_stream && stream_data.get_invite_only(value))) {
|
is_notifications_stream && stream_data.get_invite_only(value)) {
|
||||||
// You can't actually elect not to invite someone to the
|
// You can't actually elect not to invite someone to the
|
||||||
// notifications stream. We won't even show it as a choice unless
|
// notifications stream. We won't even show it as a choice unless
|
||||||
// it's the only stream you have, or if you've made it private.
|
// it's the only stream you have, or if you've made it private.
|
||||||
|
|
|
@ -66,8 +66,8 @@ var LightboxCanvas = (function () {
|
||||||
// where the last `layerX` and `layerY` movements since the last
|
// where the last `layerX` and `layerY` movements since the last
|
||||||
// `mousemove` event in this `mousedown` event were registered.
|
// `mousemove` event in this `mousedown` event were registered.
|
||||||
var polyfillMouseMovement = function (e) {
|
var polyfillMouseMovement = function (e) {
|
||||||
e.movementX = (e.layerX - lastPosition.x) || 0;
|
e.movementX = e.layerX - lastPosition.x || 0;
|
||||||
e.movementY = (e.layerY - lastPosition.y) || 0;
|
e.movementY = e.layerY - lastPosition.y || 0;
|
||||||
|
|
||||||
lastPosition = {
|
lastPosition = {
|
||||||
x: e.layerX,
|
x: e.layerX,
|
||||||
|
@ -103,7 +103,7 @@ var LightboxCanvas = (function () {
|
||||||
// normalizedDelta = delta * (1 / 20) * 1 = 0.4
|
// normalizedDelta = delta * (1 / 20) * 1 = 0.4
|
||||||
// zoom = zoom * (0.4 / 100) + 1
|
// zoom = zoom * (0.4 / 100) + 1
|
||||||
var zoom = meta.zoom * (
|
var zoom = meta.zoom * (
|
||||||
(meta.speed * meta.internalSpeedMultiplier * delta / 100) + 1
|
meta.speed * meta.internalSpeedMultiplier * delta / 100 + 1
|
||||||
);
|
);
|
||||||
|
|
||||||
funcs.setZoom(meta, zoom);
|
funcs.setZoom(meta, zoom);
|
||||||
|
@ -201,18 +201,18 @@ var LightboxCanvas = (function () {
|
||||||
|
|
||||||
displayImage: function (canvas, context, meta) {
|
displayImage: function (canvas, context, meta) {
|
||||||
meta.coords.x = Math.max(1 / (meta.zoom * 2), meta.coords.x);
|
meta.coords.x = Math.max(1 / (meta.zoom * 2), meta.coords.x);
|
||||||
meta.coords.x = Math.min(1 - (1 / (meta.zoom * 2)), meta.coords.x);
|
meta.coords.x = Math.min(1 - 1 / (meta.zoom * 2), meta.coords.x);
|
||||||
|
|
||||||
meta.coords.y = Math.max(1 / (meta.zoom * 2), meta.coords.y);
|
meta.coords.y = Math.max(1 / (meta.zoom * 2), meta.coords.y);
|
||||||
meta.coords.y = Math.min(1 - (1 / (meta.zoom * 2)), meta.coords.y);
|
meta.coords.y = Math.min(1 - 1 / (meta.zoom * 2), meta.coords.y);
|
||||||
|
|
||||||
var c = {
|
var c = {
|
||||||
x: meta.coords.x - 1,
|
x: meta.coords.x - 1,
|
||||||
y: meta.coords.y - 1,
|
y: meta.coords.y - 1,
|
||||||
};
|
};
|
||||||
|
|
||||||
var x = (meta.zoom * c.x * canvas.width) + canvas.width / 2;
|
var x = meta.zoom * c.x * canvas.width + canvas.width / 2;
|
||||||
var y = (meta.zoom * c.y * canvas.height) + canvas.height / 2;
|
var y = meta.zoom * c.y * canvas.height + canvas.height / 2;
|
||||||
var w = canvas.width * meta.zoom;
|
var w = canvas.width * meta.zoom;
|
||||||
var h = canvas.height * meta.zoom;
|
var h = canvas.height * meta.zoom;
|
||||||
|
|
||||||
|
@ -244,7 +244,7 @@ var LightboxCanvas = (function () {
|
||||||
canvas.style.width = parent.width + "px";
|
canvas.style.width = parent.width + "px";
|
||||||
|
|
||||||
|
|
||||||
canvas.height = (parent.width / meta.ratio) * 2;
|
canvas.height = parent.width / meta.ratio * 2;
|
||||||
canvas.style.height = parent.width / meta.ratio + "px";
|
canvas.style.height = parent.width / meta.ratio + "px";
|
||||||
} else {
|
} else {
|
||||||
canvas.height = parent.height * 2;
|
canvas.height = parent.height * 2;
|
||||||
|
|
|
@ -21,8 +21,8 @@ function is_topic_editable(message, edit_limit_seconds_buffer) {
|
||||||
edit_limit_seconds_buffer = edit_limit_seconds_buffer || 0;
|
edit_limit_seconds_buffer = edit_limit_seconds_buffer || 0;
|
||||||
|
|
||||||
// TODO: Change hardcoded value (24 hrs) to be realm setting
|
// TODO: Change hardcoded value (24 hrs) to be realm setting
|
||||||
return message.sent_by_me || (page_params.realm_allow_community_topic_editing
|
return message.sent_by_me || page_params.realm_allow_community_topic_editing
|
||||||
&& (86400 + edit_limit_seconds_buffer + now.diffSeconds(message.timestamp * 1000) > 0));
|
&& 86400 + edit_limit_seconds_buffer + now.diffSeconds(message.timestamp * 1000) > 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function get_editability(message, edit_limit_seconds_buffer) {
|
function get_editability(message, edit_limit_seconds_buffer) {
|
||||||
|
@ -57,8 +57,8 @@ function get_editability(message, edit_limit_seconds_buffer) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var now = new XDate();
|
var now = new XDate();
|
||||||
if ((page_params.realm_message_content_edit_limit_seconds + edit_limit_seconds_buffer +
|
if (page_params.realm_message_content_edit_limit_seconds + edit_limit_seconds_buffer +
|
||||||
now.diffSeconds(message.timestamp * 1000) > 0) && message.sent_by_me) {
|
now.diffSeconds(message.timestamp * 1000) > 0 && message.sent_by_me) {
|
||||||
return editability_types.FULL;
|
return editability_types.FULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -20,7 +20,7 @@ function process_result(data, opts) {
|
||||||
|
|
||||||
$('#connection-error').removeClass("show");
|
$('#connection-error').removeClass("show");
|
||||||
|
|
||||||
if ((messages.length === 0) && (current_msg_list === message_list.narrowed) &&
|
if (messages.length === 0 && current_msg_list === message_list.narrowed &&
|
||||||
message_list.narrowed.empty()) {
|
message_list.narrowed.empty()) {
|
||||||
// Even after trying to load more messages, we have no
|
// Even after trying to load more messages, we have no
|
||||||
// messages to display in this narrow.
|
// messages to display in this narrow.
|
||||||
|
|
|
@ -57,15 +57,15 @@ exports.MessageList.prototype = {
|
||||||
self.append_to_view(bottom_messages, opts);
|
self.append_to_view(bottom_messages, opts);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((self === exports.narrowed) && !self.empty()) {
|
if (self === exports.narrowed && !self.empty()) {
|
||||||
// If adding some new messages to the message tables caused
|
// If adding some new messages to the message tables caused
|
||||||
// our current narrow to no longer be empty, hide the empty
|
// our current narrow to no longer be empty, hide the empty
|
||||||
// feed placeholder text.
|
// feed placeholder text.
|
||||||
narrow.hide_empty_narrow_message();
|
narrow.hide_empty_narrow_message();
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((self === exports.narrowed) && !self.empty() &&
|
if (self === exports.narrowed && !self.empty() &&
|
||||||
(self.selected_id() === -1)) {
|
self.selected_id() === -1) {
|
||||||
// And also select the newly arrived message.
|
// And also select the newly arrived message.
|
||||||
self.select_id(self.selected_id(), {then_scroll: true, use_closest: true});
|
self.select_id(self.selected_id(), {then_scroll: true, use_closest: true});
|
||||||
}
|
}
|
||||||
|
@ -318,7 +318,7 @@ exports.MessageList.prototype = {
|
||||||
|
|
||||||
show_message_as_read: function (message, options) {
|
show_message_as_read: function (message, options) {
|
||||||
var row = this.get_row(message.id);
|
var row = this.get_row(message.id);
|
||||||
if ((options.from === 'pointer' && feature_flags.mark_read_at_bottom) ||
|
if (options.from === 'pointer' && feature_flags.mark_read_at_bottom ||
|
||||||
options.from === "server") {
|
options.from === "server") {
|
||||||
row.find('.unread_marker').addClass('fast_fade');
|
row.find('.unread_marker').addClass('fast_fade');
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -193,7 +193,7 @@ MessageListData.prototype = {
|
||||||
|
|
||||||
update_user_full_name: function (user_id, full_name) {
|
update_user_full_name: function (user_id, full_name) {
|
||||||
_.each(this._items, function (item) {
|
_.each(this._items, function (item) {
|
||||||
if (item.sender_id && (item.sender_id === user_id)) {
|
if (item.sender_id && item.sender_id === user_id) {
|
||||||
item.sender_full_name = full_name;
|
item.sender_full_name = full_name;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -205,7 +205,7 @@ MessageListData.prototype = {
|
||||||
// especially if we want to optimize this with some kind of
|
// especially if we want to optimize this with some kind of
|
||||||
// hash that maps sender_id -> messages.
|
// hash that maps sender_id -> messages.
|
||||||
_.each(this._items, function (item) {
|
_.each(this._items, function (item) {
|
||||||
if (item.sender_id && (item.sender_id === user_id)) {
|
if (item.sender_id && item.sender_id === user_id) {
|
||||||
item.small_avatar_url = avatar_url;
|
item.small_avatar_url = avatar_url;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -213,7 +213,7 @@ MessageListData.prototype = {
|
||||||
|
|
||||||
update_stream_name: function (stream_id, new_stream_name) {
|
update_stream_name: function (stream_id, new_stream_name) {
|
||||||
_.each(this._items, function (item) {
|
_.each(this._items, function (item) {
|
||||||
if (item.stream_id && (item.stream_id === stream_id)) {
|
if (item.stream_id && item.stream_id === stream_id) {
|
||||||
item.display_recipient = new_stream_name;
|
item.display_recipient = new_stream_name;
|
||||||
item.stream = new_stream_name;
|
item.stream = new_stream_name;
|
||||||
}
|
}
|
||||||
|
@ -545,8 +545,8 @@ MessageListData.prototype = {
|
||||||
var prev = self._next_nonlocal_message(self._items, index,
|
var prev = self._next_nonlocal_message(self._items, index,
|
||||||
function (idx) { return idx - 1; });
|
function (idx) { return idx - 1; });
|
||||||
|
|
||||||
if ((next !== undefined && current_message.id > next.id) ||
|
if (next !== undefined && current_message.id > next.id ||
|
||||||
(prev !== undefined && current_message.id < prev.id)) {
|
prev !== undefined && current_message.id < prev.id) {
|
||||||
blueslip.debug("Changed message ID from server caused out-of-order list, reordering");
|
blueslip.debug("Changed message ID from server caused out-of-order list, reordering");
|
||||||
self._items.sort(message_sort_func);
|
self._items.sort(message_sort_func);
|
||||||
if (self.muting_enabled) {
|
if (self.muting_enabled) {
|
||||||
|
|
|
@ -18,7 +18,7 @@ function MessageListView(list, table_name, collapse_messages) {
|
||||||
|
|
||||||
function mention_button_refers_to_me(elem) {
|
function mention_button_refers_to_me(elem) {
|
||||||
var user_id = $(elem).attr('data-user-id');
|
var user_id = $(elem).attr('data-user-id');
|
||||||
if ((user_id === '*') || people.is_my_user_id(user_id)) {
|
if (user_id === '*' || people.is_my_user_id(user_id)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -688,7 +688,7 @@ MessageListView.prototype = {
|
||||||
var last_visible = rows.last_visible();
|
var last_visible = rows.last_visible();
|
||||||
|
|
||||||
// Make sure we have a selected row and last visible row. (defensive)
|
// Make sure we have a selected row and last visible row. (defensive)
|
||||||
if (!(selected_row && (selected_row.length > 0) && last_visible)) {
|
if (!(selected_row && selected_row.length > 0 && last_visible)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -791,10 +791,10 @@ MessageListView.prototype = {
|
||||||
// of the bottom of the currently rendered window and the
|
// of the bottom of the currently rendered window and the
|
||||||
// bottom of the window does not abut the end of the
|
// bottom of the window does not abut the end of the
|
||||||
// message list
|
// message list
|
||||||
if (!(((selected_idx - this._render_win_start < this._RENDER_THRESHOLD)
|
if (!(selected_idx - this._render_win_start < this._RENDER_THRESHOLD
|
||||||
&& (this._render_win_start !== 0)) ||
|
&& this._render_win_start !== 0 ||
|
||||||
((this._render_win_end - selected_idx <= this._RENDER_THRESHOLD)
|
this._render_win_end - selected_idx <= this._RENDER_THRESHOLD
|
||||||
&& (this._render_win_end !== this.list.num_items())))) {
|
&& this._render_win_end !== this.list.num_items())) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -106,10 +106,10 @@ exports.set_message_position = function (message_top, message_height, viewport_i
|
||||||
function in_viewport_or_tall(rect, top_of_feed, bottom_of_feed,
|
function in_viewport_or_tall(rect, top_of_feed, bottom_of_feed,
|
||||||
require_fully_visible) {
|
require_fully_visible) {
|
||||||
if (require_fully_visible) {
|
if (require_fully_visible) {
|
||||||
return (rect.top > top_of_feed) && // Message top is in view and
|
return rect.top > top_of_feed && // Message top is in view and
|
||||||
((rect.bottom < bottom_of_feed) || // message is fully in view or
|
(rect.bottom < bottom_of_feed || // message is fully in view or
|
||||||
((rect.height > bottom_of_feed - top_of_feed) &&
|
rect.height > bottom_of_feed - top_of_feed &&
|
||||||
(rect.top < bottom_of_feed))); // message is tall.
|
rect.top < bottom_of_feed); // message is tall.
|
||||||
}
|
}
|
||||||
return rect.bottom > top_of_feed && rect.top < bottom_of_feed;
|
return rect.bottom > top_of_feed && rect.top < bottom_of_feed;
|
||||||
}
|
}
|
||||||
|
@ -334,8 +334,8 @@ exports.keep_pointer_in_view = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
var info = message_viewport.message_viewport_info();
|
var info = message_viewport.message_viewport_info();
|
||||||
var top_threshold = info.visible_top + (1 / 10 * info.visible_height);
|
var top_threshold = info.visible_top + 1 / 10 * info.visible_height;
|
||||||
var bottom_threshold = info.visible_top + (9 / 10 * info.visible_height);
|
var bottom_threshold = info.visible_top + 9 / 10 * info.visible_height;
|
||||||
|
|
||||||
function message_is_far_enough_down() {
|
function message_is_far_enough_down() {
|
||||||
if (message_viewport.at_top()) {
|
if (message_viewport.at_top()) {
|
||||||
|
@ -365,7 +365,7 @@ exports.keep_pointer_in_view = function () {
|
||||||
|
|
||||||
function message_is_far_enough_up() {
|
function message_is_far_enough_up() {
|
||||||
return message_viewport.at_bottom() ||
|
return message_viewport.at_bottom() ||
|
||||||
(next_row.offset().top <= bottom_threshold);
|
next_row.offset().top <= bottom_threshold;
|
||||||
}
|
}
|
||||||
|
|
||||||
function adjust(in_view, get_next_row) {
|
function adjust(in_view, get_next_row) {
|
||||||
|
|
|
@ -411,8 +411,8 @@ exports.update_selection = function (opts) {
|
||||||
}
|
}
|
||||||
|
|
||||||
var preserve_pre_narrowing_screen_position =
|
var preserve_pre_narrowing_screen_position =
|
||||||
(message_list.narrowed.get(msg_id) !== undefined) &&
|
message_list.narrowed.get(msg_id) !== undefined &&
|
||||||
(select_offset !== undefined);
|
select_offset !== undefined;
|
||||||
|
|
||||||
var then_scroll = !preserve_pre_narrowing_screen_position;
|
var then_scroll = !preserve_pre_narrowing_screen_position;
|
||||||
|
|
||||||
|
@ -620,8 +620,8 @@ exports.deactivate = function () {
|
||||||
|
|
||||||
if (current_msg_list.selected_id() !== -1) {
|
if (current_msg_list.selected_id() !== -1) {
|
||||||
var preserve_pre_narrowing_screen_position =
|
var preserve_pre_narrowing_screen_position =
|
||||||
(current_msg_list.selected_row().length > 0) &&
|
current_msg_list.selected_row().length > 0 &&
|
||||||
(current_msg_list.pre_narrow_offset !== undefined);
|
current_msg_list.pre_narrow_offset !== undefined;
|
||||||
var message_id_to_select;
|
var message_id_to_select;
|
||||||
var select_opts = {
|
var select_opts = {
|
||||||
then_scroll: true,
|
then_scroll: true,
|
||||||
|
@ -711,7 +711,7 @@ function pick_empty_narrow_banner() {
|
||||||
// You have no unread messages.
|
// You have no unread messages.
|
||||||
return $("#no_unread_narrow_message");
|
return $("#no_unread_narrow_message");
|
||||||
}
|
}
|
||||||
} else if ((first_operator === "stream") && !stream_data.is_subscribed(first_operand)) {
|
} else if (first_operator === "stream" && !stream_data.is_subscribed(first_operand)) {
|
||||||
// You are narrowed to a stream which does not exist or is a private stream
|
// You are narrowed to a stream which does not exist or is a private stream
|
||||||
// in which you were never subscribed.
|
// in which you were never subscribed.
|
||||||
var stream_sub = stream_data.get_sub(narrow_state.stream());
|
var stream_sub = stream_data.get_sub(narrow_state.stream());
|
||||||
|
|
|
@ -334,7 +334,7 @@ exports.narrowed_to_topic = function () {
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.narrowed_to_search = function () {
|
exports.narrowed_to_search = function () {
|
||||||
return (current_filter !== undefined) && current_filter.is_search();
|
return current_filter !== undefined && current_filter.is_search();
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.muting_enabled = function () {
|
exports.muting_enabled = function () {
|
||||||
|
|
|
@ -122,7 +122,7 @@ exports.page_down = function () {
|
||||||
|
|
||||||
exports.scroll_to_selected = function () {
|
exports.scroll_to_selected = function () {
|
||||||
var selected_row = current_msg_list.selected_row();
|
var selected_row = current_msg_list.selected_row();
|
||||||
if (selected_row && (selected_row.length !== 0)) {
|
if (selected_row && selected_row.length !== 0) {
|
||||||
message_viewport.recenter_view(selected_row);
|
message_viewport.recenter_view(selected_row);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -393,12 +393,12 @@ exports.message_is_notifiable = function (message) {
|
||||||
|
|
||||||
// Messages to muted streams that don't mention us specifically
|
// Messages to muted streams that don't mention us specifically
|
||||||
// are not notifiable.
|
// are not notifiable.
|
||||||
if ((message.type === "stream") &&
|
if (message.type === "stream" &&
|
||||||
!stream_data.in_home_view(message.stream_id)) {
|
!stream_data.in_home_view(message.stream_id)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((message.type === "stream") &&
|
if (message.type === "stream" &&
|
||||||
muting.is_topic_muted(message.stream, message.subject)) {
|
muting.is_topic_muted(message.stream, message.subject)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@ -411,14 +411,14 @@ exports.message_is_notifiable = function (message) {
|
||||||
function should_send_desktop_notification(message) {
|
function should_send_desktop_notification(message) {
|
||||||
// For streams, send if desktop notifications are enabled for this
|
// For streams, send if desktop notifications are enabled for this
|
||||||
// stream.
|
// stream.
|
||||||
if ((message.type === "stream") &&
|
if (message.type === "stream" &&
|
||||||
stream_data.receives_desktop_notifications(message.stream)) {
|
stream_data.receives_desktop_notifications(message.stream)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// For PMs and @-mentions, send if desktop notifications are
|
// For PMs and @-mentions, send if desktop notifications are
|
||||||
// enabled.
|
// enabled.
|
||||||
if ((message.type === "private") &&
|
if (message.type === "private" &&
|
||||||
page_params.enable_desktop_notifications) {
|
page_params.enable_desktop_notifications) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -440,13 +440,13 @@ function should_send_desktop_notification(message) {
|
||||||
|
|
||||||
function should_send_audible_notification(message) {
|
function should_send_audible_notification(message) {
|
||||||
// For streams, ding if sounds are enabled for this stream.
|
// For streams, ding if sounds are enabled for this stream.
|
||||||
if ((message.type === "stream") &&
|
if (message.type === "stream" &&
|
||||||
stream_data.receives_audible_notifications(message.stream)) {
|
stream_data.receives_audible_notifications(message.stream)) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// For PMs and @-mentions, ding if sounds are enabled.
|
// For PMs and @-mentions, ding if sounds are enabled.
|
||||||
if ((message.type === "private") && page_params.enable_sounds) {
|
if (message.type === "private" && page_params.enable_sounds) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -96,8 +96,8 @@ exports._build_private_messages_list = function (active_conversation, max_privat
|
||||||
|
|
||||||
var num_unread = unread.num_unread_for_person(user_ids_string);
|
var num_unread = unread.num_unread_for_person(user_ids_string);
|
||||||
|
|
||||||
var always_visible = (idx < max_private_messages) || (num_unread > 0)
|
var always_visible = idx < max_private_messages || num_unread > 0
|
||||||
|| (user_ids_string === active_conversation);
|
|| user_ids_string === active_conversation;
|
||||||
|
|
||||||
if (!always_visible) {
|
if (!always_visible) {
|
||||||
if (!zoomed_in) {
|
if (!zoomed_in) {
|
||||||
|
|
|
@ -101,9 +101,9 @@ function user_last_seen_time_status(user_id) {
|
||||||
function calculate_info_popover_placement(size, elt) {
|
function calculate_info_popover_placement(size, elt) {
|
||||||
var ypos = elt.offset().top;
|
var ypos = elt.offset().top;
|
||||||
|
|
||||||
if (!((ypos + (size / 2) < message_viewport.height()) &&
|
if (!(ypos + size / 2 < message_viewport.height() &&
|
||||||
(ypos > (size / 2)))) {
|
ypos > size / 2)) {
|
||||||
if ((ypos + size) < message_viewport.height()) {
|
if (ypos + size < message_viewport.height()) {
|
||||||
return 'bottom';
|
return 'bottom';
|
||||||
} else if (ypos > size) {
|
} else if (ypos > size) {
|
||||||
return 'top';
|
return 'top';
|
||||||
|
@ -345,7 +345,7 @@ exports.toggle_actions_popover = function (element, id) {
|
||||||
var ypos = elt.offset().top;
|
var ypos = elt.offset().top;
|
||||||
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",
|
||||||
|
@ -368,7 +368,7 @@ exports.render_actions_remind_popover = function (element, id) {
|
||||||
var ypos = elt.offset().top;
|
var ypos = elt.offset().top;
|
||||||
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",
|
||||||
|
|
|
@ -25,7 +25,7 @@ exports.is_active = function (user_id) {
|
||||||
|
|
||||||
if (presence_info[user_id]) {
|
if (presence_info[user_id]) {
|
||||||
var status = presence_info[user_id].status;
|
var status = presence_info[user_id].status;
|
||||||
if (status && (status === "active")) {
|
if (status && status === "active") {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,9 +33,9 @@ exports.open_reactions_popover = function () {
|
||||||
exports.current_user_has_reacted_to_emoji = function (message, emoji_code, type) {
|
exports.current_user_has_reacted_to_emoji = function (message, emoji_code, type) {
|
||||||
var user_id = page_params.user_id;
|
var user_id = page_params.user_id;
|
||||||
return _.any(message.reactions, function (r) {
|
return _.any(message.reactions, function (r) {
|
||||||
return (r.user.id === user_id) &&
|
return r.user.id === user_id &&
|
||||||
(r.reaction_type === type) &&
|
r.reaction_type === type &&
|
||||||
(r.emoji_code === emoji_code);
|
r.emoji_code === emoji_code;
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -206,7 +206,7 @@ exports.add_reaction = function (event) {
|
||||||
var reacted = exports.current_user_has_reacted_to_emoji(message,
|
var reacted = exports.current_user_has_reacted_to_emoji(message,
|
||||||
event.emoji_code,
|
event.emoji_code,
|
||||||
event.reaction_type);
|
event.reaction_type);
|
||||||
if (reacted && (event.user.user_id === page_params.user_id)) {
|
if (reacted && event.user.user_id === page_params.user_id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -317,7 +317,7 @@ exports.remove_reaction = function (event) {
|
||||||
var not_reacted = !exports.current_user_has_reacted_to_emoji(message,
|
var not_reacted = !exports.current_user_has_reacted_to_emoji(message,
|
||||||
emoji_code,
|
emoji_code,
|
||||||
reaction_type);
|
reaction_type);
|
||||||
if (not_reacted && (event.user.user_id === page_params.user_id)) {
|
if (not_reacted && event.user.user_id === page_params.user_id) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -37,21 +37,21 @@ $(function () {
|
||||||
if (sbWidth > 0) {
|
if (sbWidth > 0) {
|
||||||
$(".header").css("left", "-" + sbWidth + "px");
|
$(".header").css("left", "-" + sbWidth + "px");
|
||||||
$(".header-main").css("left", sbWidth + "px");
|
$(".header-main").css("left", sbWidth + "px");
|
||||||
$(".header-main").css("max-width", (1400 + sbWidth) + "px");
|
$(".header-main").css("max-width", 1400 + sbWidth + "px");
|
||||||
$(".header-main .column-middle").css("margin-right", (250 + sbWidth) + "px");
|
$(".header-main .column-middle").css("margin-right", 250 + sbWidth + "px");
|
||||||
|
|
||||||
$(".fixed-app").css("left", "-" + sbWidth + "px");
|
$(".fixed-app").css("left", "-" + sbWidth + "px");
|
||||||
$(".fixed-app .app-main").css("max-width", (1400 + sbWidth) + "px");
|
$(".fixed-app .app-main").css("max-width", 1400 + sbWidth + "px");
|
||||||
$(".fixed-app .column-middle").css("margin-left", (250 + sbWidth) + "px");
|
$(".fixed-app .column-middle").css("margin-left", 250 + sbWidth + "px");
|
||||||
|
|
||||||
$(".column-right").css("right", sbWidth + "px");
|
$(".column-right").css("right", sbWidth + "px");
|
||||||
$(".app-main .right-sidebar").css({"margin-left": 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").css("left", "-" + sbWidth + "px");
|
||||||
$(".compose-content").css({left: sbWidth + "px",
|
$(".compose-content").css({left: sbWidth + "px",
|
||||||
"margin-right": (250 + sbWidth) + "px"});
|
"margin-right": 250 + sbWidth + "px"});
|
||||||
$("#compose-container").css("max-width", (1400 + sbWidth) + "px");
|
$("#compose-container").css("max-width", 1400 + sbWidth + "px");
|
||||||
$('#sidebar-keyboard-shortcuts #keyboard-icon').css({right: sbWidth + 13 + "px"});
|
$('#sidebar-keyboard-shortcuts #keyboard-icon').css({right: sbWidth + 13 + "px"});
|
||||||
|
|
||||||
$("head").append("<style> @media (max-width: 1025px) { .compose-content, .header-main .column-middle { margin-right: " + (7 + sbWidth) + "px !important; } } " +
|
$("head").append("<style> @media (max-width: 1025px) { .compose-content, .header-main .column-middle { margin-right: " + (7 + sbWidth) + "px !important; } } " +
|
||||||
|
|
|
@ -159,7 +159,7 @@ function get_group_suggestions(all_persons, last, operators) {
|
||||||
if (_.contains(parts, person.email)) {
|
if (_.contains(parts, person.email)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
return (last_part === '') || people.person_matches_query(person, last_part);
|
return last_part === '' || people.person_matches_query(person, last_part);
|
||||||
});
|
});
|
||||||
|
|
||||||
persons.sort(compare_by_huddle(parts));
|
persons.sort(compare_by_huddle(parts));
|
||||||
|
@ -264,7 +264,7 @@ function get_topic_suggestions(last, operators) {
|
||||||
|
|
||||||
var operator = Filter.canonicalize_operator(last.operator);
|
var operator = Filter.canonicalize_operator(last.operator);
|
||||||
var operand = last.operand;
|
var operand = last.operand;
|
||||||
var negated = (operator === 'topic') && last.negated;
|
var negated = operator === 'topic' && last.negated;
|
||||||
var stream;
|
var stream;
|
||||||
var guess;
|
var guess;
|
||||||
var filter = new Filter(operators);
|
var filter = new Filter(operators);
|
||||||
|
@ -391,9 +391,9 @@ function get_special_filter_suggestions(last, operators, suggestions) {
|
||||||
var suggestion_operand = s.search_string.substring(s.search_string.indexOf(":") + 1);
|
var suggestion_operand = s.search_string.substring(s.search_string.indexOf(":") + 1);
|
||||||
// e.g for `att` search query, `has:attachment` should be suggested.
|
// e.g for `att` search query, `has:attachment` should be suggested.
|
||||||
var show_operator_suggestions = last.operator === 'search' && suggestion_operand.toLowerCase().indexOf(last_string) === 0;
|
var show_operator_suggestions = last.operator === 'search' && suggestion_operand.toLowerCase().indexOf(last_string) === 0;
|
||||||
return (s.search_string.toLowerCase().indexOf(last_string) === 0) ||
|
return s.search_string.toLowerCase().indexOf(last_string) === 0 ||
|
||||||
show_operator_suggestions ||
|
show_operator_suggestions ||
|
||||||
(s.description.toLowerCase().indexOf(last_string) === 0);
|
s.description.toLowerCase().indexOf(last_string) === 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
// Only show home if there's an empty bar
|
// Only show home if there's an empty bar
|
||||||
|
@ -478,7 +478,7 @@ function get_has_filter_suggestions(last, operators) {
|
||||||
|
|
||||||
function get_sent_by_me_suggestions(last, operators) {
|
function get_sent_by_me_suggestions(last, operators) {
|
||||||
var last_string = Filter.unparse([last]).toLowerCase();
|
var last_string = Filter.unparse([last]).toLowerCase();
|
||||||
var negated = last.negated || (last.operator === 'search' && last.operand[0] === '-');
|
var negated = last.negated || last.operator === 'search' && last.operand[0] === '-';
|
||||||
var negated_symbol = negated ? '-' : '';
|
var negated_symbol = negated ? '-' : '';
|
||||||
var verb = negated ? 'exclude ' : '';
|
var verb = negated ? 'exclude ' : '';
|
||||||
|
|
||||||
|
|
|
@ -119,8 +119,8 @@ exports.message_state = function (opts) {
|
||||||
};
|
};
|
||||||
|
|
||||||
self.ready = function () {
|
self.ready = function () {
|
||||||
return (self.data.send_finished !== undefined) &&
|
return self.data.send_finished !== undefined &&
|
||||||
(self.data.received !== undefined);
|
self.data.received !== undefined;
|
||||||
};
|
};
|
||||||
|
|
||||||
return self;
|
return self;
|
||||||
|
|
|
@ -112,7 +112,7 @@ function get_events_success(events) {
|
||||||
home_msg_list.select_id(new_pointer, {then_scroll: true, use_closest: true});
|
home_msg_list.select_id(new_pointer, {then_scroll: true, use_closest: true});
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((home_msg_list.selected_id() === -1) && !home_msg_list.empty()) {
|
if (home_msg_list.selected_id() === -1 && !home_msg_list.empty()) {
|
||||||
home_msg_list.select_id(home_msg_list.first().id, {then_scroll: false});
|
home_msg_list.select_id(home_msg_list.first().id, {then_scroll: false});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -185,8 +185,8 @@ function get_events(options) {
|
||||||
get_events_xhr = undefined;
|
get_events_xhr = undefined;
|
||||||
// If we're old enough that our message queue has been
|
// If we're old enough that our message queue has been
|
||||||
// garbage collected, immediately reload.
|
// garbage collected, immediately reload.
|
||||||
if ((xhr.status === 400) &&
|
if (xhr.status === 400 &&
|
||||||
(JSON.parse(xhr.responseText).code === 'BAD_EVENT_QUEUE_ID')) {
|
JSON.parse(xhr.responseText).code === 'BAD_EVENT_QUEUE_ID') {
|
||||||
page_params.event_queue_expired = true;
|
page_params.event_queue_expired = true;
|
||||||
reload.initiate({immediate: true,
|
reload.initiate({immediate: true,
|
||||||
save_pointer: false,
|
save_pointer: false,
|
||||||
|
@ -247,7 +247,7 @@ exports.home_view_loaded = function home_view_loaded() {
|
||||||
var watchdog_time = $.now();
|
var watchdog_time = $.now();
|
||||||
exports.check_for_unsuspend = function () {
|
exports.check_for_unsuspend = function () {
|
||||||
var new_time = $.now();
|
var new_time = $.now();
|
||||||
if ((new_time - watchdog_time) > 20000) { // 20 seconds.
|
if (new_time - watchdog_time > 20000) { // 20 seconds.
|
||||||
// Defensively reset watchdog_time here in case there's an
|
// Defensively reset watchdog_time here in case there's an
|
||||||
// exception in one of the event handlers
|
// exception in one of the event handlers
|
||||||
watchdog_time = new_time;
|
watchdog_time = new_time;
|
||||||
|
|
|
@ -69,10 +69,10 @@ exports.do_settings_change = function (request_method, url, data, status_element
|
||||||
// * disable_on_uncheck is boolean, true if sub setting should be disabled
|
// * disable_on_uncheck is boolean, true if sub setting should be disabled
|
||||||
// when main setting unchecked.
|
// when main setting unchecked.
|
||||||
exports.disable_sub_setting_onchange = function (is_checked, sub_setting_id, disable_on_uncheck) {
|
exports.disable_sub_setting_onchange = function (is_checked, sub_setting_id, disable_on_uncheck) {
|
||||||
if ((is_checked && disable_on_uncheck) || (!is_checked && !disable_on_uncheck)) {
|
if (is_checked && disable_on_uncheck || !is_checked && !disable_on_uncheck) {
|
||||||
$("#" + sub_setting_id).attr("disabled", false);
|
$("#" + sub_setting_id).attr("disabled", false);
|
||||||
$("#" + sub_setting_id + "_label").parent().removeClass("control-label-disabled");
|
$("#" + sub_setting_id + "_label").parent().removeClass("control-label-disabled");
|
||||||
} else if ((is_checked && !disable_on_uncheck) || (!is_checked && disable_on_uncheck)) {
|
} else if (is_checked && !disable_on_uncheck || !is_checked && disable_on_uncheck) {
|
||||||
$("#" + sub_setting_id).attr("disabled", "disabled");
|
$("#" + sub_setting_id).attr("disabled", "disabled");
|
||||||
$("#" + sub_setting_id + "_label").parent().addClass("control-label-disabled");
|
$("#" + sub_setting_id + "_label").parent().addClass("control-label-disabled");
|
||||||
}
|
}
|
||||||
|
|
|
@ -80,7 +80,7 @@ exports.populate_user_groups = function () {
|
||||||
var description = $('#user-groups #' + data.id + ' .description').text().trim();
|
var description = $('#user-groups #' + data.id + ' .description').text().trim();
|
||||||
var name = $('#user-groups #' + data.id + ' .name').text().trim();
|
var name = $('#user-groups #' + data.id + ' .name').text().trim();
|
||||||
|
|
||||||
if ((group_data.description === description && group_data.name === name) &&
|
if (group_data.description === description && group_data.name === name &&
|
||||||
(!draft_group.length || same_groups)) {
|
(!draft_group.length || same_groups)) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
|
@ -52,7 +52,7 @@ function format_date(date, include_hour) {
|
||||||
|
|
||||||
var str = hour >= 12 ? "PM" : "AM";
|
var str = hour >= 12 ? "PM" : "AM";
|
||||||
|
|
||||||
return month_str + " " + day + ", " + (hour % 12) + ":00" + str;
|
return month_str + " " + day + ", " + hour % 12 + ":00" + str;
|
||||||
}
|
}
|
||||||
return month_str + ' ' + day + ', ' + year;
|
return month_str + ' ' + day + ', ' + year;
|
||||||
}
|
}
|
||||||
|
|
|
@ -227,8 +227,8 @@ function show_subscription_settings(sub_row) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
// Case-insensitive.
|
// Case-insensitive.
|
||||||
var item_matches = (item.email.toLowerCase().indexOf(query) !== -1) ||
|
var item_matches = item.email.toLowerCase().indexOf(query) !== -1 ||
|
||||||
(item.full_name.toLowerCase().indexOf(query) !== -1);
|
item.full_name.toLowerCase().indexOf(query) !== -1;
|
||||||
var is_subscribed = stream_data.is_user_subscribed(sub.name, item.user_id);
|
var is_subscribed = stream_data.is_user_subscribed(sub.name, item.user_id);
|
||||||
return item_matches && !is_subscribed;
|
return item_matches && !is_subscribed;
|
||||||
},
|
},
|
||||||
|
|
|
@ -79,7 +79,7 @@ function update_spectrum(popover, update_func) {
|
||||||
var current_top_px = parseFloat(popover_root.css('top').replace('px', ''));
|
var current_top_px = parseFloat(popover_root.css('top').replace('px', ''));
|
||||||
var height_delta = -(after_height - initial_height) * 0.5;
|
var height_delta = -(after_height - initial_height) * 0.5;
|
||||||
|
|
||||||
popover_root.css('top', (current_top_px + height_delta) + "px");
|
popover_root.css('top', current_top_px + height_delta + "px");
|
||||||
}
|
}
|
||||||
|
|
||||||
function build_stream_popover(e) {
|
function build_stream_popover(e) {
|
||||||
|
|
|
@ -158,7 +158,7 @@ exports.rerender_subscribers_count = function (sub, just_subscribed) {
|
||||||
}
|
}
|
||||||
var stream_row = row_for_stream_id(sub.stream_id);
|
var stream_row = row_for_stream_id(sub.stream_id);
|
||||||
stream_data.update_subscribers_count(sub);
|
stream_data.update_subscribers_count(sub);
|
||||||
if (!sub.can_access_subscribers || (just_subscribed && sub.invite_only)) {
|
if (!sub.can_access_subscribers || just_subscribed && sub.invite_only) {
|
||||||
var rendered_sub_count = templates.render("subscription_count", sub);
|
var rendered_sub_count = templates.render("subscription_count", sub);
|
||||||
stream_row.find('.subscriber-count').expectOne().html(rendered_sub_count);
|
stream_row.find('.subscriber-count').expectOne().html(rendered_sub_count);
|
||||||
} else {
|
} else {
|
||||||
|
@ -331,7 +331,7 @@ function stream_matches_query(query, sub, attr) {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}());
|
}());
|
||||||
flag = flag && ((sub.subscribed || !query.subscribed_only) ||
|
flag = flag && (sub.subscribed || !query.subscribed_only ||
|
||||||
sub.data_temp_view === "true");
|
sub.data_temp_view === "true");
|
||||||
return flag;
|
return flag;
|
||||||
}
|
}
|
||||||
|
|
|
@ -31,8 +31,8 @@ var tictactoe_data_holder = function () {
|
||||||
}
|
}
|
||||||
|
|
||||||
return (
|
return (
|
||||||
(square_values[line[1]] === token) &&
|
square_values[line[1]] === token &&
|
||||||
(square_values[line[2]] === token));
|
square_values[line[2]] === token);
|
||||||
}
|
}
|
||||||
|
|
||||||
var board = [1, 2, 3, 4, 5, 6, 7, 8, 9];
|
var board = [1, 2, 3, 4, 5, 6, 7, 8, 9];
|
||||||
|
|
|
@ -36,7 +36,7 @@ exports.render_now = function (time, today) {
|
||||||
var days_old = Math.round(start_of_other_day.diffDays(start_of_today));
|
var days_old = Math.round(start_of_other_day.diffDays(start_of_today));
|
||||||
|
|
||||||
var is_older_year =
|
var is_older_year =
|
||||||
(start_of_today.getFullYear() - start_of_other_day.getFullYear()) > 0;
|
start_of_today.getFullYear() - start_of_other_day.getFullYear() > 0;
|
||||||
|
|
||||||
if (days_old === 0) {
|
if (days_old === 0) {
|
||||||
time_str = i18n.t("Today");
|
time_str = i18n.t("Today");
|
||||||
|
@ -250,7 +250,7 @@ exports.absolute_time = (function () {
|
||||||
today = new Date();
|
today = new Date();
|
||||||
}
|
}
|
||||||
var date = new Date(timestamp);
|
var date = new Date(timestamp);
|
||||||
var is_older_year = (today.getFullYear() - date.getFullYear()) > 0;
|
var is_older_year = today.getFullYear() - date.getFullYear() > 0;
|
||||||
var H_24 = page_params.twenty_four_hour_time;
|
var H_24 = page_params.twenty_four_hour_time;
|
||||||
var str = MONTHS[date.getMonth()] + " " + date.getDate();
|
var str = MONTHS[date.getMonth()] + " " + date.getDate();
|
||||||
// include year if message date is from a previous year
|
// include year if message date is from a previous year
|
||||||
|
|
|
@ -67,7 +67,7 @@ exports.handle_narrow_activated = function (filter) {
|
||||||
ops = filter.operands('is');
|
ops = filter.operands('is');
|
||||||
if (ops.length >= 1) {
|
if (ops.length >= 1) {
|
||||||
filter_name = ops[0];
|
filter_name = ops[0];
|
||||||
if ((filter_name === 'starred') || (filter_name === 'mentioned')) {
|
if (filter_name === 'starred' || filter_name === 'mentioned') {
|
||||||
filter_li = exports.get_global_filter_li(filter_name);
|
filter_li = exports.get_global_filter_li(filter_name);
|
||||||
filter_li.addClass('active-filter');
|
filter_li.addClass('active-filter');
|
||||||
}
|
}
|
||||||
|
@ -75,7 +75,7 @@ exports.handle_narrow_activated = function (filter) {
|
||||||
|
|
||||||
var op_is = filter.operands('is');
|
var op_is = filter.operands('is');
|
||||||
var op_pm = filter.operands('pm-with');
|
var op_pm = filter.operands('pm-with');
|
||||||
if (((op_is.length >= 1) && _.contains(op_is, "private")) || op_pm.length >= 1) {
|
if (op_is.length >= 1 && _.contains(op_is, "private") || op_pm.length >= 1) {
|
||||||
if (!people.is_valid_bulk_emails_for_compose(op_pm)) {
|
if (!people.is_valid_bulk_emails_for_compose(op_pm)) {
|
||||||
// Don't go into the else statement and close the pm_list.
|
// Don't go into the else statement and close the pm_list.
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -74,8 +74,8 @@ exports.widget = function (parent_elem, my_stream_id) {
|
||||||
|
|
||||||
if (!zoomed) {
|
if (!zoomed) {
|
||||||
// Show the most recent topics, as well as any with unread messages
|
// Show the most recent topics, as well as any with unread messages
|
||||||
var show_topic = (idx < max_topics) || (num_unread > 0) ||
|
var show_topic = idx < max_topics || num_unread > 0 ||
|
||||||
(self.active_topic === topic_name.toLowerCase());
|
self.active_topic === topic_name.toLowerCase();
|
||||||
|
|
||||||
if (!show_topic) {
|
if (!show_topic) {
|
||||||
return;
|
return;
|
||||||
|
@ -236,7 +236,7 @@ exports.zoom_in = function () {
|
||||||
var before_count = active_widget.num_items();
|
var before_count = active_widget.num_items();
|
||||||
|
|
||||||
function on_success() {
|
function on_success() {
|
||||||
if (!active_widget || (stream_id !== active_widget.get_stream_id())) {
|
if (!active_widget || stream_id !== active_widget.get_stream_id()) {
|
||||||
blueslip.warn('User re-narrowed before topic history was returned.');
|
blueslip.warn('User re-narrowed before topic history was returned.');
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -40,7 +40,7 @@ function message_hover(message_row) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// But the message edit hover icon is determined by whether the message is still editable
|
// But the message edit hover icon is determined by whether the message is still editable
|
||||||
if ((message_edit.get_editability(message) === message_edit.editability_types.FULL) &&
|
if (message_edit.get_editability(message) === message_edit.editability_types.FULL &&
|
||||||
!message.status_message) {
|
!message.status_message) {
|
||||||
message_row.find(".edit_content").html('<i class="fa fa-pencil edit_content_button" aria-hidden="true" title="Edit"></i>');
|
message_row.find(".edit_content").html('<i class="fa fa-pencil edit_content_button" aria-hidden="true" title="Edit"></i>');
|
||||||
} else {
|
} else {
|
||||||
|
@ -100,8 +100,8 @@ function initialize_kitchen_sink_stuff() {
|
||||||
var max_scroll = this.scrollHeight - self.innerHeight() - 1;
|
var max_scroll = this.scrollHeight - self.innerHeight() - 1;
|
||||||
|
|
||||||
e.stopPropagation();
|
e.stopPropagation();
|
||||||
if (((delta < 0) && (scroll <= 0)) ||
|
if (delta < 0 && scroll <= 0 ||
|
||||||
((delta > 0) && (scroll >= max_scroll))) {
|
delta > 0 && scroll >= max_scroll) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -38,7 +38,7 @@ exports.set_count_toggle_button = function (elem, count) {
|
||||||
return elem.stop(true, true).hide();
|
return elem.stop(true, true).hide();
|
||||||
}
|
}
|
||||||
return elem.hide(500);
|
return elem.hide(500);
|
||||||
} else if ((count > 0) && (count < 1000)) {
|
} else if (count > 0 && count < 1000) {
|
||||||
elem.show(500);
|
elem.show(500);
|
||||||
return elem.text(count);
|
return elem.text(count);
|
||||||
}
|
}
|
||||||
|
@ -87,8 +87,8 @@ function consider_bankruptcy() {
|
||||||
}
|
}
|
||||||
|
|
||||||
var now = new XDate(true).getTime() / 1000;
|
var now = new XDate(true).getTime() / 1000;
|
||||||
if ((page_params.unread_msgs.count > 500) &&
|
if (page_params.unread_msgs.count > 500 &&
|
||||||
(now - page_params.furthest_read_time > 60 * 60 * 24 * 2)) { // 2 days.
|
now - page_params.furthest_read_time > 60 * 60 * 24 * 2) { // 2 days.
|
||||||
var rendered_modal = templates.render('bankruptcy_modal', {
|
var rendered_modal = templates.render('bankruptcy_modal', {
|
||||||
unread_count: page_params.unread_msgs.count});
|
unread_count: page_params.unread_msgs.count});
|
||||||
$('#bankruptcy-unread-count').html(rendered_modal);
|
$('#bankruptcy-unread-count').html(rendered_modal);
|
||||||
|
|
|
@ -58,8 +58,8 @@ exports.lower_bound = function (array, arg1, arg2, arg3, arg4) {
|
||||||
|
|
||||||
exports.same_stream_and_topic = function util_same_stream_and_topic(a, b) {
|
exports.same_stream_and_topic = function util_same_stream_and_topic(a, b) {
|
||||||
// Streams and topics are case-insensitive.
|
// Streams and topics are case-insensitive.
|
||||||
return (a.stream_id === b.stream_id) &&
|
return a.stream_id === b.stream_id &&
|
||||||
(a.subject.toLowerCase() === b.subject.toLowerCase());
|
a.subject.toLowerCase() === b.subject.toLowerCase();
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.is_pm_recipient = function (email, message) {
|
exports.is_pm_recipient = function (email, message) {
|
||||||
|
@ -74,7 +74,7 @@ exports.extract_pm_recipients = function (recipients) {
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.same_recipient = function util_same_recipient(a, b) {
|
exports.same_recipient = function util_same_recipient(a, b) {
|
||||||
if ((a === undefined) || (b === undefined)) {
|
if (a === undefined || b === undefined) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (a.type !== b.type) {
|
if (a.type !== b.type) {
|
||||||
|
@ -96,8 +96,8 @@ exports.same_recipient = function util_same_recipient(a, b) {
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.same_sender = function util_same_sender(a, b) {
|
exports.same_sender = function util_same_sender(a, b) {
|
||||||
return (a !== undefined) && (b !== undefined) &&
|
return a !== undefined && b !== undefined &&
|
||||||
(a.sender_email.toLowerCase() === b.sender_email.toLowerCase());
|
a.sender_email.toLowerCase() === b.sender_email.toLowerCase();
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.normalize_recipients = function (recipients) {
|
exports.normalize_recipients = function (recipients) {
|
||||||
|
|
Loading…
Reference in New Issue