// Check if the activity is actually meant for us
let path = path.into_inner();
- let community = blocking(&context.pool(), move |conn| {
- Community::read_from_name(&conn, &path)
+ let community = blocking(context.pool(), move |conn| {
+ Community::read_from_name(conn, &path)
})
.await??;
let to_and_cc = get_activity_to_and_cc(&activity);
- if !to_and_cc.contains(&&community.actor_id()) {
+ if !to_and_cc.contains(&community.actor_id()) {
return Err(anyhow!("Activity delivered to wrong community").into());
}
// Only persons can send activities to the community, so we can get the actor as person
// unconditionally.
let actor_id = actor.actor_id();
- let person = blocking(&context.pool(), move |conn| {
- Person::read_from_apub_id(&conn, &actor_id.into())
+ let person = blocking(context.pool(), move |conn| {
+ Person::read_from_apub_id(conn, &actor_id.into())
})
.await??;
check_community_or_site_ban(&person, to_community.id, context.pool()).await?;
any_base.clone(),
person,
&to_community,
- &context,
+ context,
))
.await?;
false
};
// This will fail if they're already a follower, but ignore the error.
- blocking(&context.pool(), move |conn| {
- CommunityFollower::follow(&conn, &community_follower_form).ok()
+ blocking(context.pool(), move |conn| {
+ CommunityFollower::follow(conn, &community_follower_form).ok()
})
.await?;
.is_single_kind(&FollowType::Follow.to_string());
let any_base = activity.into_any_base()?;
if inner_kind {
- handle_undo_follow(any_base, actor_url, to_community, &context).await?;
+ handle_undo_follow(any_base, actor_url, to_community, context).await?;
Ok(false)
} else {
receive_undo_for_community(context, any_base, None, &actor_url, request_counter).await?;
let follow = Follow::from_any_base(object)?.context(location_info!())?;
verify_activity_domains_valid(&follow, &person_url, false)?;
- let person = blocking(&context.pool(), move |conn| {
- Person::read_from_apub_id(&conn, &person_url.into())
+ let person = blocking(context.pool(), move |conn| {
+ Person::read_from_apub_id(conn, &person_url.into())
})
.await??;
let community_follower_form = CommunityFollowerForm {
};
// This will fail if they aren't a follower, but ignore the error.
- blocking(&context.pool(), move |conn| {
- CommunityFollower::unfollow(&conn, &community_follower_form).ok()
+ blocking(context.pool(), move |conn| {
+ CommunityFollower::unfollow(conn, &community_follower_form).ok()
})
.await?;