|
|
|
@ -36,6 +36,7 @@ use lemmy_utils::{
|
|
|
|
|
};
|
|
|
|
|
use std::ops::Deref;
|
|
|
|
|
use url::Url;
|
|
|
|
|
use lemmy_api_common::utils::is_mod_or_admin;
|
|
|
|
|
|
|
|
|
|
#[derive(Clone, Debug)]
|
|
|
|
|
pub struct ApubComment(pub(crate) Comment);
|
|
|
|
@ -142,7 +143,9 @@ impl Object for ApubComment {
|
|
|
|
|
verify_is_remote_object(note.id.inner(), context.settings())?;
|
|
|
|
|
verify_person_in_community(¬e.attributed_to, &community, context).await?;
|
|
|
|
|
let (post, _) = note.get_parents(context).await?;
|
|
|
|
|
if post.locked {
|
|
|
|
|
let creator = note.attributed_to.dereference(context).await?;
|
|
|
|
|
let is_mod_or_admin = is_mod_or_admin(&mut context.pool(), creator, community.id)?;
|
|
|
|
|
if post.locked && !is_mod_or_admin {
|
|
|
|
|
Err(LemmyErrorType::PostIsLocked)?
|
|
|
|
|
} else {
|
|
|
|
|
Ok(())
|
|
|
|
|