mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-10-01 01:36:12 -04:00
cleanup
This commit is contained in:
parent
84a18ec0a6
commit
8f19ba365e
@ -128,8 +128,6 @@ impl Object for ApubComment {
|
|||||||
Ok(note)
|
Ok(note)
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Recursively fetches all parent comments. This can lead to a stack overflow so we need to
|
|
||||||
/// Box::pin all large futures on the heap.
|
|
||||||
#[tracing::instrument(skip_all)]
|
#[tracing::instrument(skip_all)]
|
||||||
async fn verify(
|
async fn verify(
|
||||||
note: &Note,
|
note: &Note,
|
||||||
@ -139,24 +137,14 @@ impl Object for ApubComment {
|
|||||||
verify_domains_match(note.id.inner(), expected_domain)?;
|
verify_domains_match(note.id.inner(), expected_domain)?;
|
||||||
verify_domains_match(note.attributed_to.inner(), note.id.inner())?;
|
verify_domains_match(note.attributed_to.inner(), note.id.inner())?;
|
||||||
verify_is_public(¬e.to, ¬e.cc)?;
|
verify_is_public(¬e.to, ¬e.cc)?;
|
||||||
let community = Box::pin(note.community(context)).await?;
|
let community = note.community(context).await?;
|
||||||
|
|
||||||
Box::pin(check_apub_id_valid_with_strictness(
|
check_apub_id_valid_with_strictness(note.id.inner(), community.local, context).await?;
|
||||||
note.id.inner(),
|
|
||||||
community.local,
|
|
||||||
context,
|
|
||||||
))
|
|
||||||
.await?;
|
|
||||||
verify_is_remote_object(¬e.id, context)?;
|
verify_is_remote_object(¬e.id, context)?;
|
||||||
Box::pin(verify_person_in_community(
|
verify_person_in_community(¬e.attributed_to, &community, context).await?;
|
||||||
¬e.attributed_to,
|
|
||||||
&community,
|
|
||||||
context,
|
|
||||||
))
|
|
||||||
.await?;
|
|
||||||
|
|
||||||
let (post, _) = Box::pin(note.get_parents(context)).await?;
|
let (post, _) = note.get_parents(context).await?;
|
||||||
let creator = Box::pin(note.attributed_to.dereference(context)).await?;
|
let creator = note.attributed_to.dereference(context).await?;
|
||||||
let is_mod_or_admin = is_mod_or_admin(&mut context.pool(), &creator, community.id)
|
let is_mod_or_admin = is_mod_or_admin(&mut context.pool(), &creator, community.id)
|
||||||
.await
|
.await
|
||||||
.is_ok();
|
.is_ok();
|
||||||
|
@ -65,7 +65,6 @@ impl Note {
|
|||||||
// some cases we have to fetch user profiles too, and reach the limit after only 25 comments
|
// some cases we have to fetch user profiles too, and reach the limit after only 25 comments
|
||||||
// or so.
|
// or so.
|
||||||
// A cleaner solution would be converting the recursion into a loop, but that is tricky.
|
// A cleaner solution would be converting the recursion into a loop, but that is tricky.
|
||||||
// Use a lower request limit here. Otherwise we can run into stack overflow due to recursion.
|
|
||||||
if context.request_count() > MAX_COMMENT_DEPTH_LIMIT as u32 {
|
if context.request_count() > MAX_COMMENT_DEPTH_LIMIT as u32 {
|
||||||
Err(LemmyErrorType::MaxCommentDepthReached)?;
|
Err(LemmyErrorType::MaxCommentDepthReached)?;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user