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

This commit is contained in:
Nutomic 2024-05-22 14:29:01 +02:00 committed by GitHub
parent a39c19c9db
commit 973f39601c
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -37,6 +37,12 @@ pub async fn remove_comment(
) )
.await?; .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 // Do the remove
let removed = data.removed; let removed = data.removed;
let updated_comment = Comment::update( let updated_comment = Comment::update(