diff --git a/public/s/js/sidebar-activity.js b/public/s/js/sidebar-activity.js index 3b65396..43c0993 100644 --- a/public/s/js/sidebar-activity.js +++ b/public/s/js/sidebar-activity.js @@ -499,6 +499,19 @@ `; } + // Robust fallback for is_long if server didn't provide it, plus inline media checks + let isLong = c.is_long; + const rawText = c.content || c.body || ''; + if (isLong === undefined) { + isLong = rawText.length > 120 + || rawText.split('\n').length > 2 + || (c.files && c.files.length > 0); + } + // Always force isLong if there are inline media tags that expand vertically + if (!isLong && /\[(video|audio|youtube|img)\]|!\[|https?:\/\//i.test(rawText)) { + isLong = true; + } + return `
@@ -511,7 +524,7 @@
${timeStr}
-
${displayContent}${attachmentsHtml}${pollHtml}
+
${displayContent}${attachmentsHtml}${pollHtml}
${itemPreview} `; diff --git a/src/inc/routes/comments.mjs b/src/inc/routes/comments.mjs index 1cd0ad0..6415b13 100644 --- a/src/inc/routes/comments.mjs +++ b/src/inc/routes/comments.mjs @@ -614,7 +614,8 @@ export default (router, tpl) => { // sidebar renders the correct clamped state immediately on first paint. const activityIsLong = content.length > 120 || content.split('\n').length > 2 - || activityFiles.length > 0; + || activityFiles.length > 0 + || /\[(video|audio|youtube|img)\]|!\[|https?:\/\//i.test(content); db.notify('activity', JSON.stringify({ user_id: req.session.id, item_id: item_id, @@ -1103,7 +1104,8 @@ export default (router, tpl) => { // attachments (images/video) will also push height above the limit. const isLong = commentContent.length > 120 || commentContent.split('\n').length > 2 - || commentFiles.length > 0; + || commentFiles.length > 0 + || /\[(video|audio|youtube|img)\]|!\[|https?:\/\//i.test(commentContent); return { ...c,