mirror of
https://github.com/zulip/zulip.git
synced 2025-11-10 08:56:10 +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()) {
|
||||
return;
|
||||
}
|
||||
@@ -115,16 +115,22 @@ exports.update_rendered_messages = function (messages, get_element) {
|
||||
// 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
|
||||
// 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) {
|
||||
var elt = get_element(message);
|
||||
var elts = get_elements(message);
|
||||
var should_fade_message = !util.same_recipient(focused_recipient, message);
|
||||
|
||||
_.each(elts, function (elt) {
|
||||
if (should_fade_message) {
|
||||
elt.removeClass("unfaded").addClass("faded");
|
||||
} else {
|
||||
elt.removeClass("faded").addClass("unfaded");
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
|
||||
return exports;
|
||||
|
||||
@@ -626,11 +626,16 @@ MessageList.prototype = {
|
||||
// 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
|
||||
// state.
|
||||
var get_element = function (message) {
|
||||
return rows.get(message.id, table_name);
|
||||
var get_elements = function (message) {
|
||||
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) {
|
||||
|
||||
Reference in New Issue
Block a user