* Fixing clippy lints.
* Revert object id display
* Trying to fix clippy again
// 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();
.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);
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(),
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(),
}
pub enum DeletableObjects {
- Community(ApubCommunity),
- Comment(ApubComment),
- Post(ApubPost),
+ Community(Box<ApubCommunity>),
+ Comment(Box<ApubComment>),
+ Post(Box<ApubPost>),
}
impl DeletableObjects {
context: &LemmyContext,
) -> Result<DeletableObjects, LemmyError> {
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())
}
#[serde(untagged)]
#[activity_handler(LemmyContext)]
pub enum SharedInboxActivities {
- GroupInboxActivities(GroupInboxActivities),
+ GroupInboxActivities(Box<GroupInboxActivities>),
// 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<PersonInboxActivities>),
#[derive(Clone, Debug)]
pub enum PostOrComment {
- Post(ApubPost),
- Comment(ApubComment),
+ Post(Box<ApubPost>),
+ Comment(Box<ApubComment>),
}
#[derive(Deserialize)]
) -> Result<Option<Self>, 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))),
})
}
request_counter: &mut i32,
) -> Result<Self, LemmyError> {
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?,
+ )),
})
}
}
let activity = serde_json::from_str::<WithContext<SharedInboxActivities>>(&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