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, traits::Actor};
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<ActorT>(
22 activity: AnnouncableActivities,
24 community: &ApubCommunity,
25 mut inboxes: Vec<Url>,
26 context: &LemmyContext,
27 ) -> Result<(), LemmyError>
29 ActorT: Actor + ActorType,
31 inboxes.push(community.shared_inbox_or_inbox());
32 send_lemmy_activity(context, activity.clone(), actor, inboxes, false).await?;
35 AnnounceActivity::send(activity, community, context).await?;
41 #[tracing::instrument(skip_all)]
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, local_instance(context), request_counter)