mirror of https://github.com/zulip/zulip.git
Fade properly via groups when toggling fade on compose
(imported from commit 865c9daf8a267cfa65f7daceddff55a816b9c22c)
This commit is contained in:
parent
9275901277
commit
63bcf98e71
|
@ -45,8 +45,8 @@ function _display_users_normally() {
|
||||||
$('.user_sidebar_entry').removeClass('faded').removeClass('unfaded');
|
$('.user_sidebar_entry').removeClass('faded').removeClass('unfaded');
|
||||||
}
|
}
|
||||||
|
|
||||||
function change_fade_state(elt, should_fade_message) {
|
function change_fade_state(elt, should_fade_group) {
|
||||||
if (should_fade_message) {
|
if (should_fade_group) {
|
||||||
elt.removeClass("unfaded").addClass("faded");
|
elt.removeClass("unfaded").addClass("faded");
|
||||||
} else {
|
} else {
|
||||||
elt.removeClass("faded").addClass("unfaded");
|
elt.removeClass("faded").addClass("unfaded");
|
||||||
|
@ -54,23 +54,22 @@ function change_fade_state(elt, should_fade_message) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function _fade_messages() {
|
function _fade_messages() {
|
||||||
var i;
|
var i, first_message, first_row;
|
||||||
var should_fade_message = false;
|
var should_fade_group = false;
|
||||||
var visible_messages = viewport.visible_messages(false);
|
var visible_groups = viewport.visible_groups(false);
|
||||||
|
|
||||||
normal_display = false;
|
normal_display = false;
|
||||||
|
|
||||||
// Update the visible messages first, before the compose box opens
|
// Update the visible messages first, before the compose box opens
|
||||||
for (i = 0; i < visible_messages.length; i++) {
|
for (i = 0; i < visible_groups.length; i++) {
|
||||||
should_fade_message = !fade_heuristic(focused_recipient, visible_messages[i]);
|
first_row = rows.first_message_in_group(visible_groups[i]);
|
||||||
var elt = current_msg_list.get_row(visible_messages[i].id);
|
first_message = current_msg_list.get(rows.id(first_row));
|
||||||
var recipient_row = rows.get_message_recipient_row(elt);
|
should_fade_group = !fade_heuristic(focused_recipient, first_message);
|
||||||
|
|
||||||
change_fade_state(elt, should_fade_message);
|
change_fade_state($(visible_groups[i]), should_fade_group);
|
||||||
change_fade_state(recipient_row, should_fade_message);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Defer updating all messages so that the compose box can open sooner
|
// Defer updating all message groups so that the compose box can open sooner
|
||||||
setTimeout(function (expected_msg_list, expected_recipient) {
|
setTimeout(function (expected_msg_list, expected_recipient) {
|
||||||
var all_groups = rows.get_table(current_msg_list.table_name).find(".recipient_row");
|
var all_groups = rows.get_table(current_msg_list.table_name).find(".recipient_row");
|
||||||
|
|
||||||
|
@ -80,14 +79,14 @@ function _fade_messages() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
should_fade_message = false;
|
should_fade_group = false;
|
||||||
|
|
||||||
// Note: The below algorithm relies on the fact that all_elts is
|
// Note: The below algorithm relies on the fact that all_elts is
|
||||||
// sorted as it would be displayed in the message view
|
// sorted as it would be displayed in the message view
|
||||||
for (i = 0; i < all_groups.length; i++) {
|
for (i = 0; i < all_groups.length; i++) {
|
||||||
var group_elt = $(all_groups[i]);
|
var group_elt = $(all_groups[i]);
|
||||||
should_fade_message = !fade_heuristic(focused_recipient, rows.recipient_from_group(group_elt));
|
should_fade_group = !fade_heuristic(focused_recipient, rows.recipient_from_group(group_elt));
|
||||||
change_fade_state(group_elt, should_fade_message);
|
change_fade_state(group_elt, should_fade_group);
|
||||||
}
|
}
|
||||||
|
|
||||||
ui.update_floating_recipient_bar();
|
ui.update_floating_recipient_bar();
|
||||||
|
|
Loading…
Reference in New Issue