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_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 let object_value = serde_json::to_value(&activity)?;
34 insert_activity(activity_id, object_value, true, false, context.pool()).await?;
35 AnnounceActivity::send(activity, community, context).await?;
41 async fn get_community_from_moderators_url(
43 context: &LemmyContext,
44 request_counter: &mut i32,
45 ) -> Result<ApubCommunity, LemmyError> {
46 let community_id = Url::parse(&moderators.to_string().replace("/moderators", ""))?;
47 ObjectId::new(community_id)
48 .dereference(context, request_counter)