]> Untitled Git - lemmy.git/commitdiff
Dont serve apub json for removed objects (ref #2522) (#2538)
authorNutomic <me@nutomic.com>
Sat, 5 Nov 2022 00:57:28 +0000 (00:57 +0000)
committerGitHub <noreply@github.com>
Sat, 5 Nov 2022 00:57:28 +0000 (20:57 -0400)
crates/apub/src/http/comment.rs
crates/apub/src/http/community.rs
crates/apub/src/http/post.rs

index 59cbee8e89309b71ffd605717fb7fcadb29dbbd8..4a498a16af15114de827784408841af22ea9c7c3 100644 (file)
@@ -30,7 +30,7 @@ pub(crate) async fn get_apub_comment(
     return Err(NotFound.into());
   }
 
-  if !comment.deleted {
+  if !comment.deleted && !comment.removed {
     Ok(create_apub_response(&comment.into_apub(&**context).await?))
   } else {
     Ok(create_apub_tombstone_response(comment.ap_id.clone()))
index 6f68e8fc4ec44319e781f262d19c0288b50780c3..d4528236e090c09a8ab046b0dbdb95a2bada3d15 100644 (file)
@@ -40,7 +40,7 @@ pub(crate) async fn get_apub_community_http(
   .await??
   .into();
 
-  if !community.deleted {
+  if !community.deleted && !community.removed {
     let apub = community.into_apub(&**context).await?;
 
     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)
   })
   .await??;
+  if community.deleted || community.removed {
+    return Err(LemmyError::from_message("deleted"));
+  }
+
   let id = ObjectId::new(generate_outbox_url(&community.actor_id)?);
   let outbox_data = CommunityContext(community.into(), context.get_ref().clone());
   let outbox: ApubCommunityOutbox = id
@@ -101,6 +105,10 @@ pub(crate) async fn get_apub_community_moderators(
   })
   .await??
   .into();
+  if community.deleted || community.removed {
+    return Err(LemmyError::from_message("deleted"));
+  }
+
   let id = ObjectId::new(generate_outbox_url(&community.actor_id)?);
   let outbox_data = CommunityContext(community, context.get_ref().clone());
   let moderators: ApubCommunityModerators = id
index 0e321d176a14f0ece12734cf354adab1b29d7ae8..5960db4478f473f368fbc82a1582695a39447ba6 100644 (file)
@@ -30,7 +30,7 @@ pub(crate) async fn get_apub_post(
     return Err(NotFound.into());
   }
 
-  if !post.deleted {
+  if !post.deleted && !post.removed {
     Ok(create_apub_response(&post.into_apub(&context).await?))
   } else {
     Ok(create_apub_tombstone_response(post.ap_id.clone()))