Dont serve apub json for removed objects (ref #2522) (#2538)

urlencode-db-url
Nutomic 2 years ago committed by GitHub
parent 50a2233b52
commit a0a84d91ce
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -30,7 +30,7 @@ pub(crate) async fn get_apub_comment(
return Err(NotFound.into()); return Err(NotFound.into());
} }
if !comment.deleted { if !comment.deleted && !comment.removed {
Ok(create_apub_response(&comment.into_apub(&**context).await?)) Ok(create_apub_response(&comment.into_apub(&**context).await?))
} else { } else {
Ok(create_apub_tombstone_response(comment.ap_id.clone())) Ok(create_apub_tombstone_response(comment.ap_id.clone()))

@ -40,7 +40,7 @@ pub(crate) async fn get_apub_community_http(
.await?? .await??
.into(); .into();
if !community.deleted { if !community.deleted && !community.removed {
let apub = community.into_apub(&**context).await?; let apub = community.into_apub(&**context).await?;
Ok(create_apub_response(&apub)) Ok(create_apub_response(&apub))
@ -83,6 +83,10 @@ pub(crate) async fn get_apub_community_outbox(
Community::read_from_name(conn, &info.community_name, false) Community::read_from_name(conn, &info.community_name, false)
}) })
.await??; .await??;
if community.deleted || community.removed {
return Err(LemmyError::from_message("deleted"));
}
let id = ObjectId::new(generate_outbox_url(&community.actor_id)?); let id = ObjectId::new(generate_outbox_url(&community.actor_id)?);
let outbox_data = CommunityContext(community.into(), context.get_ref().clone()); let outbox_data = CommunityContext(community.into(), context.get_ref().clone());
let outbox: ApubCommunityOutbox = id let outbox: ApubCommunityOutbox = id
@ -101,6 +105,10 @@ pub(crate) async fn get_apub_community_moderators(
}) })
.await?? .await??
.into(); .into();
if community.deleted || community.removed {
return Err(LemmyError::from_message("deleted"));
}
let id = ObjectId::new(generate_outbox_url(&community.actor_id)?); let id = ObjectId::new(generate_outbox_url(&community.actor_id)?);
let outbox_data = CommunityContext(community, context.get_ref().clone()); let outbox_data = CommunityContext(community, context.get_ref().clone());
let moderators: ApubCommunityModerators = id let moderators: ApubCommunityModerators = id

@ -30,7 +30,7 @@ pub(crate) async fn get_apub_post(
return Err(NotFound.into()); return Err(NotFound.into());
} }
if !post.deleted { if !post.deleted && !post.removed {
Ok(create_apub_response(&post.into_apub(&context).await?)) Ok(create_apub_response(&post.into_apub(&context).await?))
} else { } else {
Ok(create_apub_tombstone_response(post.ap_id.clone())) Ok(create_apub_tombstone_response(post.ap_id.clone()))

Loading…
Cancel
Save