diff --git a/apps/web/app/api/video/comment/delete/route.ts b/apps/web/app/api/video/comment/delete/route.ts index 1e6a12db992..46f671827c1 100644 --- a/apps/web/app/api/video/comment/delete/route.ts +++ b/apps/web/app/api/video/comment/delete/route.ts @@ -41,13 +41,18 @@ export async function DELETE(request: NextRequest) { ); } - // Delete the comment and all its replies + // Delete the comment and only the replies authored by the same user. + // Replies written by other users are preserved (never delete others' + // content), even though that can leave them visually orphaned. await db() .delete(comments) .where( - or( - eq(comments.id, commentId.value), - eq(comments.parentCommentId, commentId.value), + and( + eq(comments.authorId, user.id), + or( + eq(comments.id, commentId.value), + eq(comments.parentCommentId, commentId.value), + ), ), );