use crate::{
activities::{
- community::{announce::GetCommunity, send_activity_in_community},
+ community::send_activity_in_community,
generate_activity_id,
verify_is_public,
verify_mod_action,
verify_person_in_community,
},
activity_lists::AnnouncableActivities,
- local_instance,
objects::{community::ApubCommunity, person::ApubPerson},
- protocol::activities::community::update::UpdateCommunity,
+ protocol::{activities::community::update::UpdateCommunity, InCommunity},
ActorType,
};
use activitypub_federation::{
cc: vec![community.actor_id()],
kind: UpdateType::Update,
id: id.clone(),
+ audience: Some(ObjectId::new(community.actor_id())),
};
let activity = AnnouncableActivities::UpdateCommunity(update);
request_counter: &mut i32,
) -> Result<(), LemmyError> {
verify_is_public(&self.to, &self.cc)?;
- let community = self.get_community(context, request_counter).await?;
+ let community = self.community(context, request_counter).await?;
verify_person_in_community(&self.actor, &community, context, request_counter).await?;
verify_mod_action(
&self.actor,
context: &Data<LemmyContext>,
request_counter: &mut i32,
) -> Result<(), LemmyError> {
- let community = self.get_community(context, request_counter).await?;
+ let community = self.community(context, request_counter).await?;
let community_update_form = self.object.into_update_form();
Ok(())
}
}
-
-#[async_trait::async_trait(?Send)]
-impl GetCommunity for UpdateCommunity {
- #[tracing::instrument(skip_all)]
- async fn get_community(
- &self,
- context: &LemmyContext,
- request_counter: &mut i32,
- ) -> Result<ApubCommunity, LemmyError> {
- let cid = ObjectId::new(self.object.id.clone());
- cid
- .dereference(context, local_instance(context).await, request_counter)
- .await
- }
-}