From 973f39601c32663fc54c5f672de0dd47642c6493 Mon Sep 17 00:00:00 2001 From: Nutomic Date: Wed, 22 May 2024 14:29:01 +0200 Subject: [PATCH] Dont allow removing comment which was deleted (fixes #4731) (#4732) --- crates/api_crud/src/comment/remove.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/api_crud/src/comment/remove.rs b/crates/api_crud/src/comment/remove.rs index 02ae7b9fd..926472b94 100644 --- a/crates/api_crud/src/comment/remove.rs +++ b/crates/api_crud/src/comment/remove.rs @@ -37,6 +37,12 @@ pub async fn remove_comment( ) .await?; + // Don't allow removing or restoring comment which was deleted by user, as it would reveal + // the comment text in mod log. + if orig_comment.comment.deleted { + return Err(LemmyErrorType::CouldntUpdateComment.into()); + } + // Do the remove let removed = data.removed; let updated_comment = Comment::update(