mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-26 22:31:20 +00:00
cleanup
This commit is contained in:
parent
3bc61dd40d
commit
3fefc89a2e
2 changed files with 6 additions and 9 deletions
|
@ -233,6 +233,10 @@ impl ActivityHandler for Page {
|
|||
#[async_trait::async_trait]
|
||||
impl InCommunity for Page {
|
||||
async fn community(&self, context: &Data<LemmyContext>) -> LemmyResult<ApubCommunity> {
|
||||
if let Some(audience) = &self.audience {
|
||||
return audience.dereference(context).await;
|
||||
}
|
||||
|
||||
let community = match &self.attributed_to {
|
||||
AttributedTo::Lemmy(_) => {
|
||||
let mut iter = self.to.iter().merge(self.cc.iter());
|
||||
|
@ -243,11 +247,7 @@ impl InCommunity for Page {
|
|||
break c;
|
||||
}
|
||||
} else {
|
||||
let audience = self
|
||||
.audience
|
||||
.clone()
|
||||
.ok_or(LemmyErrorType::NoCommunityFoundInCc)?;
|
||||
break audience.dereference(context).await?;
|
||||
Err(LemmyErrorType::CouldntFindCommunity)?;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -255,13 +255,12 @@ impl InCommunity for Page {
|
|||
p.iter()
|
||||
.find(|a| a.kind == PersonOrGroupType::Group)
|
||||
.map(|a| ObjectId::<ApubCommunity>::from(a.id.clone().into_inner()))
|
||||
.ok_or(LemmyErrorType::PageDoesNotSpecifyGroup)?
|
||||
.ok_or(LemmyErrorType::CouldntFindCommunity)?
|
||||
.dereference(context)
|
||||
.await?
|
||||
}
|
||||
};
|
||||
|
||||
// TODO: doesnt make sense to do this here as were checking audience against itself
|
||||
if let Some(audience) = &self.audience {
|
||||
verify_community_matches(audience, community.actor_id.clone())?;
|
||||
}
|
||||
|
|
|
@ -99,8 +99,6 @@ pub enum LemmyErrorType {
|
|||
PersonIsBannedFromSite(String),
|
||||
InvalidVoteValue,
|
||||
PageDoesNotSpecifyCreator,
|
||||
PageDoesNotSpecifyGroup,
|
||||
NoCommunityFoundInCc,
|
||||
NoEmailSetup,
|
||||
LocalSiteNotSetup,
|
||||
EmailSmtpServerNeedsAPort,
|
||||
|
|
Loading…
Reference in a new issue