diff --git a/crates/api/src/comment.rs b/crates/api/src/comment.rs index e6eef2cba..e673d4979 100644 --- a/crates/api/src/comment.rs +++ b/crates/api/src/comment.rs @@ -194,7 +194,7 @@ impl Perform for CreateCommentLike { // Only add the like if the score isnt 0 let comment = orig_comment.comment; - let object = PostOrComment::Comment(comment.into()); + let object = PostOrComment::Comment(Box::new(comment.into())); let do_add = like_form.score != 0 && (like_form.score == 1 || like_form.score == -1); if do_add { let like_form2 = like_form.clone(); diff --git a/crates/api/src/post.rs b/crates/api/src/post.rs index f22104eb7..c7acb08fb 100644 --- a/crates/api/src/post.rs +++ b/crates/api/src/post.rs @@ -73,7 +73,7 @@ impl Perform for CreatePostLike { .await??; let community_id = post.community_id; - let object = PostOrComment::Post(post); + let object = PostOrComment::Post(Box::new(post)); // Only add the like if the score isnt 0 let do_add = like_form.score != 0 && (like_form.score == 1 || like_form.score == -1); diff --git a/crates/api_crud/src/comment/create.rs b/crates/api_crud/src/comment/create.rs index 4c7bb34f0..1c133be23 100644 --- a/crates/api_crud/src/comment/create.rs +++ b/crates/api_crud/src/comment/create.rs @@ -154,7 +154,7 @@ impl PerformCrud for CreateComment { context, ) .await?; - let object = PostOrComment::Comment(apub_comment); + let object = PostOrComment::Comment(Box::new(apub_comment)); Vote::send( &object, &local_user_view.person.clone().into(), diff --git a/crates/api_crud/src/post/create.rs b/crates/api_crud/src/post/create.rs index 1147c1a32..248adee6c 100644 --- a/crates/api_crud/src/post/create.rs +++ b/crates/api_crud/src/post/create.rs @@ -146,7 +146,7 @@ impl PerformCrud for CreatePost { context, ) .await?; - let object = PostOrComment::Post(apub_post); + let object = PostOrComment::Post(Box::new(apub_post)); Vote::send( &object, &local_user_view.person.clone().into(), diff --git a/crates/apub/src/activities/deletion/mod.rs b/crates/apub/src/activities/deletion/mod.rs index 1d5a3836f..ddd607a7c 100644 --- a/crates/apub/src/activities/deletion/mod.rs +++ b/crates/apub/src/activities/deletion/mod.rs @@ -53,9 +53,9 @@ pub async fn send_apub_remove( } pub enum DeletableObjects { - Community(ApubCommunity), - Comment(ApubComment), - Post(ApubPost), + Community(Box), + Comment(Box), + Post(Box), } impl DeletableObjects { @@ -64,13 +64,13 @@ impl DeletableObjects { context: &LemmyContext, ) -> Result { if let Some(c) = ApubCommunity::read_from_apub_id(ap_id.clone(), context).await? { - return Ok(DeletableObjects::Community(c)); + return Ok(DeletableObjects::Community(Box::new(c))); } if let Some(p) = ApubPost::read_from_apub_id(ap_id.clone(), context).await? { - return Ok(DeletableObjects::Post(p)); + return Ok(DeletableObjects::Post(Box::new(p))); } if let Some(c) = ApubComment::read_from_apub_id(ap_id.clone(), context).await? { - return Ok(DeletableObjects::Comment(c)); + return Ok(DeletableObjects::Comment(Box::new(c))); } Err(diesel::NotFound.into()) } diff --git a/crates/apub/src/activity_lists.rs b/crates/apub/src/activity_lists.rs index 2b695111f..98736ae2f 100644 --- a/crates/apub/src/activity_lists.rs +++ b/crates/apub/src/activity_lists.rs @@ -35,7 +35,7 @@ use serde::{Deserialize, Serialize}; #[serde(untagged)] #[activity_handler(LemmyContext)] pub enum SharedInboxActivities { - GroupInboxActivities(GroupInboxActivities), + GroupInboxActivities(Box), // Note, pm activities need to be at the end, otherwise comments will end up here. We can probably // avoid this problem by replacing createpm.object with our own struct, instead of NoteExt. PersonInboxActivities(Box), diff --git a/crates/apub/src/fetcher/post_or_comment.rs b/crates/apub/src/fetcher/post_or_comment.rs index 2ca84bee1..55d494811 100644 --- a/crates/apub/src/fetcher/post_or_comment.rs +++ b/crates/apub/src/fetcher/post_or_comment.rs @@ -11,8 +11,8 @@ use url::Url; #[derive(Clone, Debug)] pub enum PostOrComment { - Post(ApubPost), - Comment(ApubComment), + Post(Box), + Comment(Box), } #[derive(Deserialize)] @@ -39,10 +39,10 @@ impl ApubObject for PostOrComment { ) -> Result, LemmyError> { let post = ApubPost::read_from_apub_id(object_id.clone(), data).await?; Ok(match post { - Some(o) => Some(PostOrComment::Post(o)), + Some(o) => Some(PostOrComment::Post(Box::new(o))), None => ApubComment::read_from_apub_id(object_id, data) .await? - .map(PostOrComment::Comment), + .map(|c| PostOrComment::Comment(Box::new(c))), }) } @@ -79,12 +79,12 @@ impl ApubObject for PostOrComment { request_counter: &mut i32, ) -> Result { Ok(match apub { - PageOrNote::Page(p) => { - PostOrComment::Post(ApubPost::from_apub(p, context, request_counter).await?) - } - PageOrNote::Note(n) => { - PostOrComment::Comment(ApubComment::from_apub(n, context, request_counter).await?) - } + PageOrNote::Page(p) => PostOrComment::Post(Box::new( + ApubPost::from_apub(p, context, request_counter).await?, + )), + PageOrNote::Note(n) => PostOrComment::Comment(Box::new( + ApubComment::from_apub(n, context, request_counter).await?, + )), }) } } diff --git a/crates/apub/src/http/mod.rs b/crates/apub/src/http/mod.rs index b3288b0d9..0fd8de8bd 100644 --- a/crates/apub/src/http/mod.rs +++ b/crates/apub/src/http/mod.rs @@ -49,7 +49,7 @@ pub async fn shared_inbox( let activity = serde_json::from_str::>(&unparsed)?; match activity.inner() { SharedInboxActivities::GroupInboxActivities(g) => { - receive_group_inbox(g, activity_data, request, &context).await + receive_group_inbox(*g, activity_data, request, &context).await } SharedInboxActivities::PersonInboxActivities(p) => { receive_person_inbox(*p, activity_data, request, &context).await