mirror of https://github.com/zulip/zulip.git
Use getBoundingClientRect() to more cheaply see if a messages could be condensed.
(imported from commit 34d45fbc95a3597d27d167c9c02e73f9325edbee)
This commit is contained in:
parent
5fc6fb5896
commit
ea582d4e12
|
@ -590,8 +590,8 @@ exports.hide_loading_more_messages_indicator = function () {
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
function could_be_condensed(content) {
|
function could_be_condensed(elem) {
|
||||||
return content.height() > (viewport.height() * 0.65);
|
return elem.getBoundingClientRect().height > viewport.height() * 0.65;
|
||||||
}
|
}
|
||||||
|
|
||||||
function show_more_link(row) {
|
function show_more_link(row) {
|
||||||
|
@ -1392,7 +1392,8 @@ exports.process_condensing = function (index, elem) {
|
||||||
var content = $(elem).find(".message_content");
|
var content = $(elem).find(".message_content");
|
||||||
var message = current_msg_list.get(rows.id($(elem)));
|
var message = current_msg_list.get(rows.id($(elem)));
|
||||||
if (content !== undefined && message !== undefined) {
|
if (content !== undefined && message !== undefined) {
|
||||||
if (could_be_condensed(content)) {
|
var long_message = could_be_condensed(elem);
|
||||||
|
if (long_message) {
|
||||||
// All long messages are flagged as such.
|
// All long messages are flagged as such.
|
||||||
content.addClass("could-be-condensed");
|
content.addClass("could-be-condensed");
|
||||||
}
|
}
|
||||||
|
@ -1405,7 +1406,7 @@ exports.process_condensing = function (index, elem) {
|
||||||
} else if (message.condensed === false) {
|
} else if (message.condensed === false) {
|
||||||
uncondense($(elem));
|
uncondense($(elem));
|
||||||
return;
|
return;
|
||||||
} else if (could_be_condensed(content)) {
|
} else if (long_message) {
|
||||||
// By default, condense a long message.
|
// By default, condense a long message.
|
||||||
condense($(elem));
|
condense($(elem));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue