1 Commits
Author SHA1 Message Date
Lauri Ojansivu ab1f60d806 Cap comment replies at one level of threading, grouped under their parent.
A comment's Reply link (added earlier for #5907) let a reply be posted
against ANY comment, including another reply, so clicking Reply enough
times nested comments arbitrarily deep. For #3011, a reply now attaches
to a reply's own parent instead of the reply itself - resolveParentId()
(models/cardComments.js) makes that decision once, is unit tested, and
is applied both when the client opens the composer (so the "In reply
to ..." banner already names the right comment) and again in a
CardComments.before.insert hook server-side, so the cap holds no
matter how a comment is inserted.

Replies also now render directly under their top-level parent instead
of interleaved by date with unrelated comments: groupCommentsByThread()
(imports/lib/commentThreading.js) reorders the already-sorted flat list
the comments template already used, with no schema or query change.

The "Replying to <author>" indicator on the composer reuses the
existing, already fully translated comment-in-reply-to string plus the
parent comment's author name, rather than adding a new i18n key that
would need translating across every locale file for a small wording
difference.

Added tests/commentReplyFlattening.test.cjs (the one-level cap, both
the client and server wiring) and tests/commentThreadGrouping.test.cjs
(grouping, including the regression cases: a flat list of only
top-level comments is unchanged, and a comment whose parent was
deleted still renders as top-level rather than being dropped).

Thanks to FuXXz and xet7 !

Closes #3011,
2026-09-10 20:28:46 +03:00