From 43c3a7c47358272525b95f60184f8c98c1bd8fb2 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Wed, 22 May 2024 12:00:26 +0200 Subject: [PATCH] Dont allow removing comment which was deleted (fixes #4731) --- 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(