2 activities::send_lemmy_activity,
3 activity_lists::AnnouncableActivities,
5 objects::community::ApubCommunity,
6 protocol::activities::community::announce::AnnounceActivity,
9 use activitypub_federation::core::object_id::ObjectId;
10 use lemmy_utils::error::LemmyError;
11 use lemmy_websocket::LemmyContext;
20 #[tracing::instrument(skip_all)]
21 pub(crate) async fn send_activity_in_community<T: ActorType>(
22 activity: AnnouncableActivities,
25 community: &ApubCommunity,
26 mut inboxes: Vec<Url>,
27 context: &LemmyContext,
28 ) -> Result<(), LemmyError> {
29 inboxes.push(community.shared_inbox_or_inbox_url());
30 send_lemmy_activity(context, &activity, activity_id, actor, inboxes, false).await?;
33 AnnounceActivity::send(activity, community, context).await?;
39 #[tracing::instrument(skip_all)]
40 async fn get_community_from_moderators_url(
42 context: &LemmyContext,
43 request_counter: &mut i32,
44 ) -> Result<ApubCommunity, LemmyError> {
45 let community_id = Url::parse(&moderators.to_string().replace("/moderators", ""))?;
46 ObjectId::new(community_id)
47 .dereference::<LemmyError>(context, local_instance(context), request_counter)