Dont allow removing comment which was deleted (fixes #4731)

comment-remove-delete
Felix Ableitner 2024-05-22 12:00:26 +02:00
parent a39c19c9db
commit 43c3a7c473
1 changed files with 6 additions and 0 deletions

View File

@ -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(