From f6c92ebafe09d6b3964f7f7a1d3c03b864864f1d Mon Sep 17 00:00:00 2001 From: Aleksander Machniak Date: Sat, 27 Jul 2024 09:15:57 +0200 Subject: [PATCH] Fix bug where a long subject title could not be displayed in some cases (#9416) --- CHANGELOG.md | 1 + program/js/app.js | 28 +++++++++++++++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a9b0c1699db..7869ed6f3ea 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ - Fix invalid line break characters in multi-line text in Sieve scripts (#9543) - Fix bug where "with attachment" filter could fail on some fts engines (#9514) - Fix bug where an unhandled exception was caused by an invalid image attachment (#9475) +- Fix bug where a long subject title could not be displayed in some cases (#9416) ## Release 1.6.7 diff --git a/program/js/app.js b/program/js/app.js index c91f90e0598..7e827418d19 100644 --- a/program/js/app.js +++ b/program/js/app.js @@ -3280,7 +3280,14 @@ function rcube_webmail() if (!mbox || (mbox == this.env.mailbox && !this.is_multifolder_listing())) return; +<<<<<<< HEAD var lock = false, post_data = this.selection_post_data({_target_mbox: mbox, _uid: uids}); +======= + query[uid_param] = uid; + cols.subject = '' + cols.subject + ''; + } +>>>>>>> fdeb13727... Fix bug where a long subject title could not be displayed in some cases (#9416) // exit if selection is empty if (!post_data._uid) @@ -10169,13 +10176,20 @@ function rcube_webmail() // some static methods -rcube_webmail.long_subject_title = function(elem, indent, text_elem) -{ - if (!elem.title) { - var $elem = $(text_elem || elem); - if ($elem.width() + (indent || 0) * 15 > $elem.parent().width()) - elem.title = rcube_webmail.subject_text($elem[0]); - } +rcube_webmail.long_subject_title = function (elem, indent, text_elem) { + if (!elem.title) { + var siblings_width = 0, $elem = $(text_elem || elem); + + $elem.siblings().each(function () { + // Note: width() returns 0 for elements with icons in :before (Elastic) + siblings_width += $(this).width() + (parseFloat(window.getComputedStyle(this, ':before').width) || 0); + }); + + // Note: 3px to be on the safe side, but also specifically for Elastic + if ($elem.width() + siblings_width + (indent || 0) * 15 >= $elem.parent().width() - 3) { + elem.title = rcube_webmail.subject_text($elem[0]); + } + } }; rcube_webmail.long_subject_title_ex = function(elem)