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},
14 routes::ChatServerParam,
18 use activitystreams::{
20 base::{AnyBase, BaseExt},
23 use actix_web::{client::Client, HttpResponse};
25 pub async fn receive_announce(
29 chat_server: ChatServerParam,
30 ) -> Result<HttpResponse, LemmyError> {
31 let announce = Announce::from_any_base(activity)?.unwrap();
33 // ensure that announce and community come from the same instance
34 let community = get_community_id_from_activity(&announce)?;
35 announce.id(community.domain().unwrap())?;
37 let kind = announce.object().as_single_kind_str();
38 let object = announce.object();
39 let object2 = object.clone().one().unwrap();
41 Some("Create") => receive_create(object2, client, pool, chat_server).await,
42 Some("Update") => receive_update(object2, client, pool, chat_server).await,
43 Some("Like") => receive_like(object2, client, pool, chat_server).await,
44 Some("Dislike") => receive_dislike(object2, client, pool, chat_server).await,
45 Some("Delete") => receive_delete(object2, client, pool, chat_server).await,
46 Some("Remove") => receive_remove(object2, client, pool, chat_server).await,
47 Some("Undo") => receive_undo(object2, client, pool, chat_server).await,
48 _ => receive_unhandled_activity(announce),