mirror of
https://github.com/multica-ai/multica.git
synced 2026-07-24 02:39:42 +02:00
fix(comments): cascade delete replies when parent comment is deleted
When a parent comment is deleted, remove all its replies from the timeline instead of promoting them to top-level (orphaned replies have no context). Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -316,11 +316,7 @@ export function IssueDetail({ issueId, onDelete }: IssueDetailProps) {
|
||||
try {
|
||||
await api.deleteComment(commentId);
|
||||
setTimeline((prev) =>
|
||||
prev
|
||||
// Promote replies of deleted comment to top-level
|
||||
.map((e) => e.parent_id === commentId ? { ...e, parent_id: null } : e)
|
||||
// Remove the deleted comment
|
||||
.filter((e) => e.id !== commentId)
|
||||
prev.filter((e) => e.id !== commentId && e.parent_id !== commentId)
|
||||
);
|
||||
} catch {
|
||||
toast.error("Failed to delete comment");
|
||||
@@ -386,9 +382,7 @@ export function IssueDetail({ issueId, onDelete }: IssueDetailProps) {
|
||||
const { comment_id, issue_id } = payload as CommentDeletedPayload;
|
||||
if (issue_id === id) {
|
||||
setTimeline((prev) =>
|
||||
prev
|
||||
.map((e) => e.parent_id === comment_id ? { ...e, parent_id: null } : e)
|
||||
.filter((e) => e.id !== comment_id)
|
||||
prev.filter((e) => e.id !== comment_id && e.parent_id !== comment_id)
|
||||
);
|
||||
}
|
||||
}, [id]),
|
||||
|
||||
Reference in New Issue
Block a user