2 activities::community::announce::{AnnouncableActivities, AnnounceActivity},
3 check_is_apub_id_valid,
8 use itertools::Itertools;
9 use lemmy_apub_lib::traits::ActorType;
10 use lemmy_db_schema::source::community::Community;
11 use lemmy_utils::LemmyError;
12 use lemmy_websocket::LemmyContext;
19 pub mod undo_block_user;
22 async fn list_community_follower_inboxes(
23 community: &Community,
24 additional_inboxes: Vec<Url>,
25 context: &LemmyContext,
26 ) -> Result<Vec<Url>, LemmyError> {
30 .get_follower_inboxes(context.pool(), &context.settings())
37 .filter(|inbox| inbox.host_str() != Some(&context.settings().hostname))
38 .filter(|inbox| check_is_apub_id_valid(inbox, false, &context.settings()).is_ok())
39 .map(|inbox| inbox.to_owned())
44 pub(crate) async fn send_to_community<T: ActorType>(
45 activity: AnnouncableActivities,
48 community: &Community,
49 additional_inboxes: Vec<Url>,
50 context: &LemmyContext,
51 ) -> Result<(), LemmyError> {
52 // if this is a local community, we need to do an announce from the community instead
54 insert_activity(activity_id, activity.clone(), true, false, context.pool()).await?;
55 AnnounceActivity::send(activity, community, additional_inboxes, context).await?;
57 let mut inboxes = additional_inboxes;
58 inboxes.push(community.shared_inbox_or_inbox_url());
59 send_lemmy_activity(context, &activity, activity_id, actor, inboxes, false).await?;