diff --git a/public/s/js/comments.js b/public/s/js/comments.js index bb64a47..6d33705 100644 --- a/public/s/js/comments.js +++ b/public/s/js/comments.js @@ -133,7 +133,7 @@ class CommentSystem { } else { // It's a reply - find root and attach there const root = findRoot(c); - if (root) { + if (root && root !== c) { // If replying to a non-root, capture the username for @mention const directParent = map.get(c.parent_id); if (directParent && directParent.id !== root.id) { diff --git a/src/inc/routes/comments.mjs b/src/inc/routes/comments.mjs index 9671397..426106f 100644 --- a/src/inc/routes/comments.mjs +++ b/src/inc/routes/comments.mjs @@ -38,7 +38,7 @@ export default (router, tpl) => { FROM comments c JOIN "user" u ON c.user_id = u.id LEFT JOIN user_options uo ON uo.user_id = u.id - WHERE c.item_id = ${itemId} + WHERE c.item_id = ${itemId} AND c.is_deleted = false ORDER BY COALESCE(c.is_pinned, false) DESC, c.created_at ${db.unsafe(sort === 'new' ? 'DESC' : 'ASC')} `;