2 activities::send_lemmy_activity,
3 activity_lists::AnnouncableActivities,
5 objects::community::ApubCommunity,
6 protocol::activities::community::announce::AnnounceActivity,
8 use lemmy_apub_lib::{object_id::ObjectId, traits::ActorType};
9 use lemmy_utils::LemmyError;
10 use lemmy_websocket::LemmyContext;
18 pub mod undo_block_user;
21 pub(crate) async fn send_to_community<T: ActorType>(
22 activity: AnnouncableActivities,
25 community: &ApubCommunity,
26 additional_inboxes: Vec<Url>,
27 context: &LemmyContext,
28 ) -> Result<(), LemmyError> {
29 // if this is a local community, we need to do an announce from the community instead
31 insert_activity(activity_id, activity.clone(), true, false, context.pool()).await?;
32 AnnounceActivity::send(activity, community, additional_inboxes, context).await?;
34 let mut inboxes = additional_inboxes;
35 inboxes.push(community.shared_inbox_or_inbox_url());
36 send_lemmy_activity(context, &activity, activity_id, actor, inboxes, false).await?;
42 async fn get_community_from_moderators_url(
44 context: &LemmyContext,
45 request_counter: &mut i32,
46 ) -> Result<ApubCommunity, LemmyError> {
47 let community_id = Url::parse(&moderators.to_string().replace("/moderators", ""))?;
48 ObjectId::new(community_id)
49 .dereference(context, request_counter)