mirror of
https://github.com/zulip/zulip.git
synced 2025-11-09 08:26:11 +00:00
Properly fade recipient bar of incoming messages.
This fixes #1682, a recent regression that came out of a5a47e13fc9d, which introduced the update_rendered_messages() function in compose_fade.js. The original implementation was finding the table row for a message, but not the table row for its recipient bar. Now we style both elements. (imported from commit a9628df0b03f79a24dfa68f4f2061eda2ca8ecea)
This commit is contained in:
@@ -107,7 +107,7 @@ exports.update_message_list = function () {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
exports.update_rendered_messages = function (messages, get_element) {
|
exports.update_rendered_messages = function (messages, get_elements) {
|
||||||
if (_want_normal_display()) {
|
if (_want_normal_display()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -115,15 +115,21 @@ exports.update_rendered_messages = function (messages, get_element) {
|
|||||||
// This loop is superficially similar to some code in _fade_messages, but an
|
// This loop is superficially similar to some code in _fade_messages, but an
|
||||||
// important difference here is that we look at each message individually, whereas
|
// important difference here is that we look at each message individually, whereas
|
||||||
// the other code takes advantage of blocks beneath recipient bars.
|
// the other code takes advantage of blocks beneath recipient bars.
|
||||||
|
//
|
||||||
|
// get_elements() is plural, because we can get up to two elements:
|
||||||
|
// the message (always)
|
||||||
|
// the recipient bar (sometimes)
|
||||||
_.each(messages, function (message) {
|
_.each(messages, function (message) {
|
||||||
var elt = get_element(message);
|
var elts = get_elements(message);
|
||||||
var should_fade_message = !util.same_recipient(focused_recipient, message);
|
var should_fade_message = !util.same_recipient(focused_recipient, message);
|
||||||
|
|
||||||
if (should_fade_message) {
|
_.each(elts, function (elt) {
|
||||||
elt.removeClass("unfaded").addClass("faded");
|
if (should_fade_message) {
|
||||||
} else {
|
elt.removeClass("unfaded").addClass("faded");
|
||||||
elt.removeClass("faded").addClass("unfaded");
|
} else {
|
||||||
}
|
elt.removeClass("faded").addClass("unfaded");
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -626,11 +626,16 @@ MessageList.prototype = {
|
|||||||
// of rows.js from compose_fade. We provide a callback function to be lazy--
|
// of rows.js from compose_fade. We provide a callback function to be lazy--
|
||||||
// compose_fade may not actually need the elements depending on its internal
|
// compose_fade may not actually need the elements depending on its internal
|
||||||
// state.
|
// state.
|
||||||
var get_element = function (message) {
|
var get_elements = function (message) {
|
||||||
return rows.get(message.id, table_name);
|
var message_row = rows.get(message.id, table_name);
|
||||||
|
var lst = [message_row];
|
||||||
|
if (message.include_recipient) {
|
||||||
|
lst.unshift(message_row.prev('.recipient_row'));
|
||||||
|
}
|
||||||
|
return lst;
|
||||||
};
|
};
|
||||||
|
|
||||||
compose_fade.update_rendered_messages(messages, get_element);
|
compose_fade.update_rendered_messages(messages, get_elements);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this === current_msg_list && messages_are_new) {
|
if (this === current_msg_list && messages_are_new) {
|
||||||
|
|||||||
Reference in New Issue
Block a user