4 create::receive_create,
5 delete::receive_delete,
6 dislike::receive_dislike,
8 remove::receive_remove,
10 update::receive_update,
12 shared_inbox::{get_community_id_from_activity, receive_unhandled_activity},
16 use activitystreams::{
18 base::{AnyBase, BaseExt},
21 use actix_web::HttpResponse;
23 use lemmy_utils::{location_info, LemmyError};
25 pub async fn receive_announce(
27 context: &LemmyContext,
28 ) -> Result<HttpResponse, LemmyError> {
29 let announce = Announce::from_any_base(activity)?.context(location_info!())?;
31 // ensure that announce and community come from the same instance
32 let community = get_community_id_from_activity(&announce)?;
33 announce.id(community.domain().context(location_info!())?)?;
35 let kind = announce.object().as_single_kind_str();
36 let object = announce.object();
37 let object2 = object.clone().one().context(location_info!())?;
39 Some("Create") => receive_create(object2, context).await,
40 Some("Update") => receive_update(object2, context).await,
41 Some("Like") => receive_like(object2, context).await,
42 Some("Dislike") => receive_dislike(object2, context).await,
43 Some("Delete") => receive_delete(object2, context).await,
44 Some("Remove") => receive_remove(object2, context).await,
45 Some("Undo") => receive_undo(object2, context).await,
46 _ => receive_unhandled_activity(announce),