mods-comment-locked
Felix Ableitner 3 months ago
parent 16bd481aa8
commit 71eb3faebc

@ -56,7 +56,9 @@ pub async fn create_comment(
check_post_deleted_or_removed(&post)?;
// Check if post is locked, no new comments
let is_mod_or_admin = is_mod_or_admin(&mut context.pool(), local_user_view.person, community_id)?;
let is_mod_or_admin = is_mod_or_admin(&mut context.pool(), &local_user_view.person, community_id)
.await
.is_ok();
if post.locked && !is_mod_or_admin {
Err(LemmyErrorType::Locked)?
}

@ -143,7 +143,9 @@ impl Object for ApubComment {
verify_person_in_community(&note.attributed_to, &community, context).await?;
let (post, _) = note.get_parents(context).await?;
let creator = note.attributed_to.dereference(context).await?;
let is_mod_or_admin = is_mod_or_admin(&mut context.pool(), creator, community.id)?;
let is_mod_or_admin = is_mod_or_admin(&mut context.pool(), &creator, community.id)
.await
.is_ok();
if post.locked && !is_mod_or_admin {
Err(LemmyErrorType::PostIsLocked)?
} else {

Loading…
Cancel
Save