use crate::{
activities::{
block::{generate_cc, SiteOrCommunity},
- community::{announce::GetCommunity, send_activity_in_community},
+ community::send_activity_in_community,
generate_activity_id,
send_lemmy_activity,
verify_is_public,
},
activity_lists::AnnouncableActivities,
local_instance,
- objects::{community::ApubCommunity, instance::remote_instance_inboxes, person::ApubPerson},
+ objects::{instance::remote_instance_inboxes, person::ApubPerson},
protocol::activities::block::block_user::BlockUser,
ActorType,
};
expires: Option<NaiveDateTime>,
context: &LemmyContext,
) -> Result<BlockUser, LemmyError> {
+ let audience = if let SiteOrCommunity::Community(c) = target {
+ Some(ObjectId::new(c.actor_id()))
+ } else {
+ None
+ };
Ok(BlockUser {
actor: ObjectId::new(mod_.actor_id()),
to: vec![public()],
BlockType::Block,
&context.settings().get_protocol_and_hostname(),
)?,
+ audience,
expires: expires.map(convert_datetime),
})
}
Ok(())
}
}
-
-#[async_trait::async_trait(?Send)]
-impl GetCommunity for BlockUser {
- #[tracing::instrument(skip_all)]
- async fn get_community(
- &self,
- context: &LemmyContext,
- request_counter: &mut i32,
- ) -> Result<ApubCommunity, LemmyError> {
- let target = self
- .target
- .dereference(context, local_instance(context).await, request_counter)
- .await?;
- match target {
- SiteOrCommunity::Community(c) => Ok(c),
- SiteOrCommunity::Site(_) => Err(anyhow!("Calling get_community() on site activity").into()),
- }
- }
-}