mirror of
https://github.com/wekan/wekan.git
synced 2026-11-25 04:49:41 -05:00
Comments gain an optional parentId with a Reply link and an 'in reply to' quote (#5907, MVP single-level threading). New board setting restrictCommentEditing (default off): when on, only a comment's author may edit/delete it, enforced server-side via collection hooks (#5906). canEditComment decision unit tested. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2.4 KiB
2.4 KiB
Comment replies and comment editing restriction
This document describes two related comment features (initial MVP versions).
Threaded replies (issue #5907)
Comments on a card can now reply to a specific earlier comment.
- Each card comment has an optional
parentIdfield referencing the_idof the comment it replies to. Top-level comments leave it empty. - A Reply link appears next to each comment (for board members). Clicking it opens the new-comment form with an "In reply to ..." banner showing the parent comment text; the banner can be cancelled to post a normal top-level comment.
- Replies are rendered indented beneath the thread, and also show an "In reply to: " quote for context.
MVP limitations
- Threading is a single visual level of indentation; replies-to-replies are all indented the same amount rather than nested arbitrarily deep.
- Ordering still follows comment creation time; replies are not re-grouped directly under their parent.
- Deleting a parent comment does not delete or re-parent its replies; the "In reply to" quote simply disappears if the parent is gone.
Restrict comment editing (issue #5906)
A board-level setting controls whether board admins may moderate other users' comments.
- Board setting:
restrictCommentEditing(Boolean, defaultfalse).false(default): historical behaviour — board admins may edit/delete any comment on the board.true: board admins may not edit or delete comments authored by other users. Only the comment's own author can edit/delete it.
- Enforcement lives on the server in
models/cardComments.jsviabefore.update/before.removecollection hooks, which throw aMeteor.Errorwhen the action is not allowed. The UI also hides the edit/delete links accordingly, using the same decision function. - The decision is a pure, unit-tested function
canEditComment({ isAuthor, isBoardAdmin, restrictCommentEditing })exported frommodels/cardComments.js.
Getter / setter
Boards documents gain:
board.getRestrictCommentEditing()— returns the boolean.board.setRestrictCommentEditing(value)— updates the setting.
MVP limitations
- No dedicated Admin Panel / board-settings UI toggle is wired up yet; the setting is enforced end to end but is currently set programmatically / via the API. A board-settings checkbox can be added later.