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