mirror of
https://github.com/zulip/zulip.git
synced 2025-11-19 05:58:25 +00:00
Change signature of ui.process_condensing().
I renamed ui.process_condensing() to ui.condense_and_collapse(), and, more importantly, it now takes a list of elements, not a single element, which allows us to do some computations outside the loop. (imported from commit d5984088030c2a0d4ec8b258c7fcec3e84caf2b1)
This commit is contained in:
@@ -401,7 +401,7 @@ MessageListView.prototype = {
|
||||
|
||||
// Must happen after the elements are inserted into the document for
|
||||
// getBoundingClientRect to work.
|
||||
_.each(rendered_elems, ui.process_condensing);
|
||||
ui.condense_and_collapse(rendered_elems);
|
||||
|
||||
// Must happen after anything that changes the height of messages has
|
||||
// taken effect.
|
||||
|
||||
@@ -249,7 +249,7 @@ exports.activate = function (operators, opts) {
|
||||
// above us could change size -- which is problematic, because it
|
||||
// could cause us to lose our position. But doing this here, right
|
||||
// after showing the table, seems to cause us to win the race.
|
||||
_.each($("tr.message_row"), ui.process_condensing);
|
||||
ui.condense_and_collapse($("tr.message_row"));
|
||||
|
||||
reset_load_more_status();
|
||||
if (! defer_selecting_closest) {
|
||||
|
||||
@@ -1705,13 +1705,14 @@ exports.restore_compose_cursor = function () {
|
||||
.caret(saved_compose_cursor, saved_compose_cursor);
|
||||
};
|
||||
|
||||
exports.process_condensing = function (elem) {
|
||||
exports.condense_and_collapse = function (elems) {
|
||||
var height_cutoff = viewport.height() * 0.65;
|
||||
|
||||
function could_be_condensed(elem) {
|
||||
return elem.getBoundingClientRect().height > height_cutoff;
|
||||
}
|
||||
|
||||
_.each(elems, function (elem) {
|
||||
var content = $(elem).find(".message_content");
|
||||
var message = current_msg_list.get(rows.id($(elem)));
|
||||
if (content !== undefined && message !== undefined) {
|
||||
@@ -1741,6 +1742,7 @@ exports.process_condensing = function (elem) {
|
||||
$(elem).find(".message_expander").show();
|
||||
}
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
$(function () {
|
||||
|
||||
Reference in New Issue
Block a user