Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
Nutomic committed Sep 30, 2024
1 parent 84a18ec commit dcfc9a7
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 18 deletions.
2 changes: 1 addition & 1 deletion api_tests/run-federation-test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ killall -s1 lemmy_server || true
popd

pnpm i
pnpm api-test || true
pnpm api-test-comment || true

killall -s1 lemmy_server || true
killall -s1 pict-rs || true
Expand Down
22 changes: 5 additions & 17 deletions crates/apub/src/objects/comment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,8 +128,6 @@ impl Object for ApubComment {
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)]
async fn verify(
note: &Note,
Expand All @@ -139,24 +137,14 @@ impl Object for ApubComment {
verify_domains_match(note.id.inner(), expected_domain)?;
verify_domains_match(note.attributed_to.inner(), note.id.inner())?;
verify_is_public(&note.to, &note.cc)?;
let community = Box::pin(note.community(context)).await?;
let community = note.community(context).await?;

Box::pin(check_apub_id_valid_with_strictness(
note.id.inner(),
community.local,
context,
))
.await?;
check_apub_id_valid_with_strictness(note.id.inner(), community.local, context).await?;
verify_is_remote_object(&note.id, context)?;
Box::pin(verify_person_in_community(
&note.attributed_to,
&community,
context,
))
.await?;
verify_person_in_community(&note.attributed_to, &community, context).await?;

let (post, _) = Box::pin(note.get_parents(context)).await?;
let creator = Box::pin(note.attributed_to.dereference(context)).await?;
let (post, _) = note.get_parents(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)
.await
.is_ok();
Expand Down

0 comments on commit dcfc9a7

Please sign in to comment.