]> Untitled Git - lemmy.git/blobdiff - lemmy_apub/src/inbox/shared_inbox.rs
Move websocket code into workspace (#107)
[lemmy.git] / lemmy_apub / src / inbox / shared_inbox.rs
similarity index 83%
rename from src/apub/inbox/shared_inbox.rs
rename to lemmy_apub/src/inbox/shared_inbox.rs
index da79510823174c8b1b433e527d2b853a5b129267..b9077ebe9e688f785a6c931c902d2b3a59e56dba 100644 (file)
@@ -1,26 +1,23 @@
 use crate::{
-  apub::{
-    check_is_apub_id_valid,
-    community::do_announce,
-    extensions::signatures::verify,
-    fetcher::{
-      get_or_fetch_and_upsert_actor,
-      get_or_fetch_and_upsert_community,
-      get_or_fetch_and_upsert_user,
-    },
-    inbox::activities::{
-      announce::receive_announce,
-      create::receive_create,
-      delete::receive_delete,
-      dislike::receive_dislike,
-      like::receive_like,
-      remove::receive_remove,
-      undo::receive_undo,
-      update::receive_update,
-    },
-    insert_activity,
+  check_is_apub_id_valid,
+  community::do_announce,
+  extensions::signatures::verify,
+  fetcher::{
+    get_or_fetch_and_upsert_actor,
+    get_or_fetch_and_upsert_community,
+    get_or_fetch_and_upsert_user,
   },
-  LemmyContext,
+  inbox::activities::{
+    announce::receive_announce,
+    create::receive_create,
+    delete::receive_delete,
+    dislike::receive_dislike,
+    like::receive_like,
+    remove::receive_remove,
+    undo::receive_undo,
+    update::receive_update,
+  },
+  insert_activity,
 };
 use activitystreams::{
   activity::{ActorAndObject, ActorAndObjectRef},
@@ -32,6 +29,7 @@ use actix_web::{web, HttpRequest, HttpResponse};
 use anyhow::Context;
 use lemmy_db::user::User_;
 use lemmy_utils::{location_info, LemmyError};
+use lemmy_websocket::LemmyContext;
 use log::debug;
 use serde::{Deserialize, Serialize};
 use std::fmt::Debug;
@@ -97,7 +95,7 @@ pub async fn shared_inbox(
   res
 }
 
-pub(in crate::apub::inbox) fn receive_unhandled_activity<A>(
+pub(in crate::inbox) fn receive_unhandled_activity<A>(
   activity: A,
 ) -> Result<HttpResponse, LemmyError>
 where
@@ -107,7 +105,7 @@ where
   Ok(HttpResponse::NotImplemented().finish())
 }
 
-pub(in crate::apub::inbox) async fn get_user_from_activity<T, A>(
+pub(in crate::inbox) async fn get_user_from_activity<T, A>(
   activity: &T,
   context: &LemmyContext,
 ) -> Result<User_, LemmyError>
@@ -119,7 +117,7 @@ where
   get_or_fetch_and_upsert_user(&user_uri, context).await
 }
 
-pub(in crate::apub::inbox) fn get_community_id_from_activity<T, A>(
+pub(in crate::inbox) fn get_community_id_from_activity<T, A>(
   activity: &T,
 ) -> Result<Url, LemmyError>
 where
@@ -136,7 +134,7 @@ where
   )
 }
 
-pub(in crate::apub::inbox) async fn announce_if_community_is_local<T, Kind>(
+pub(in crate::inbox) async fn announce_if_community_is_local<T, Kind>(
   activity: T,
   user: &User_,
   context: &LemmyContext,