From 89853e6707e91e612d4f679a865847818e51eb87 Mon Sep 17 00:00:00 2001 From: Felix Ableitner Date: Thu, 11 Nov 2021 20:11:09 +0100 Subject: [PATCH] remove unused code --- crates/apub/src/activity_lists.rs | 4 ++-- crates/apub/src/protocol/objects/note.rs | 29 +++--------------------- crates/apub/src/protocol/objects/page.rs | 14 +----------- 3 files changed, 6 insertions(+), 41 deletions(-) diff --git a/crates/apub/src/activity_lists.rs b/crates/apub/src/activity_lists.rs index f2f4625e4..00d2d439f 100644 --- a/crates/apub/src/activity_lists.rs +++ b/crates/apub/src/activity_lists.rs @@ -108,8 +108,8 @@ impl GetCommunity for AnnouncableActivities { UndoBlockUserFromCommunity(a) => a.get_community(context, request_counter).await?, AddMod(a) => a.get_community(context, request_counter).await?, RemoveMod(a) => a.get_community(context, request_counter).await?, - Page(a) => a.get_community(context, request_counter).await?, - Note(a) => a.get_community(context, request_counter).await?, + Page(_) => unimplemented!(), + Note(_) => unimplemented!(), }; Ok(community) } diff --git a/crates/apub/src/protocol/objects/note.rs b/crates/apub/src/protocol/objects/note.rs index ca36f47f2..784e6f9f8 100644 --- a/crates/apub/src/protocol/objects/note.rs +++ b/crates/apub/src/protocol/objects/note.rs @@ -1,7 +1,6 @@ use crate::{ - activities::community::announce::GetCommunity, fetcher::post_or_comment::PostOrComment, - objects::{comment::ApubComment, community::ApubCommunity, person::ApubPerson, post::ApubPost}, + objects::{comment::ApubComment, person::ApubPerson, post::ApubPost}, protocol::Source, }; use activitystreams::{object::kind::NoteType, unparsed::Unparsed}; @@ -14,11 +13,7 @@ use lemmy_apub_lib::{ traits::ActivityHandler, values::MediaTypeHtml, }; -use lemmy_db_schema::{ - newtypes::CommentId, - source::{community::Community, post::Post}, - traits::Crud, -}; +use lemmy_db_schema::{newtypes::CommentId, source::post::Post, traits::Crud}; use lemmy_utils::LemmyError; use lemmy_websocket::LemmyContext; use serde::{Deserialize, Serialize}; @@ -101,24 +96,6 @@ impl ActivityHandler for Note { Err(anyhow!("Announce/Page can only be sent, not received").into()) } async fn receive(self, _: &Data, _: &mut i32) -> Result<(), LemmyError> { - Ok(()) - } -} - -#[async_trait::async_trait(?Send)] -impl GetCommunity for Note { - async fn get_community( - &self, - context: &LemmyContext, - request_counter: &mut i32, - ) -> Result { - let post = self.get_parents(context, request_counter).await?.0; - Ok( - blocking(context.pool(), move |conn| { - Community::read(conn, post.community_id) - }) - .await?? - .into(), - ) + unimplemented!() } } diff --git a/crates/apub/src/protocol/objects/page.rs b/crates/apub/src/protocol/objects/page.rs index 63f9555e3..dbf52eee0 100644 --- a/crates/apub/src/protocol/objects/page.rs +++ b/crates/apub/src/protocol/objects/page.rs @@ -1,5 +1,4 @@ use crate::{ - activities::community::announce::GetCommunity, objects::{community::ApubCommunity, person::ApubPerson, post::ApubPost}, protocol::{ImageObject, Source}, }; @@ -88,17 +87,6 @@ impl ActivityHandler for Page { Err(anyhow!("Announce/Page can only be sent, not received").into()) } async fn receive(self, _: &Data, _: &mut i32) -> Result<(), LemmyError> { - Ok(()) - } -} - -#[async_trait::async_trait(?Send)] -impl GetCommunity for Page { - async fn get_community( - &self, - context: &LemmyContext, - request_counter: &mut i32, - ) -> Result { - self.extract_community(context, request_counter).await + unimplemented!() } }