remove unused code

more-federation-compat
Felix Ableitner 2021-11-11 20:11:09 +01:00
parent f129cd51b8
commit 89853e6707
3 changed files with 6 additions and 41 deletions

View File

@ -108,8 +108,8 @@ impl GetCommunity for AnnouncableActivities {
UndoBlockUserFromCommunity(a) => a.get_community(context, request_counter).await?, UndoBlockUserFromCommunity(a) => a.get_community(context, request_counter).await?,
AddMod(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?, RemoveMod(a) => a.get_community(context, request_counter).await?,
Page(a) => a.get_community(context, request_counter).await?, Page(_) => unimplemented!(),
Note(a) => a.get_community(context, request_counter).await?, Note(_) => unimplemented!(),
}; };
Ok(community) Ok(community)
} }

View File

@ -1,7 +1,6 @@
use crate::{ use crate::{
activities::community::announce::GetCommunity,
fetcher::post_or_comment::PostOrComment, fetcher::post_or_comment::PostOrComment,
objects::{comment::ApubComment, community::ApubCommunity, person::ApubPerson, post::ApubPost}, objects::{comment::ApubComment, person::ApubPerson, post::ApubPost},
protocol::Source, protocol::Source,
}; };
use activitystreams::{object::kind::NoteType, unparsed::Unparsed}; use activitystreams::{object::kind::NoteType, unparsed::Unparsed};
@ -14,11 +13,7 @@ use lemmy_apub_lib::{
traits::ActivityHandler, traits::ActivityHandler,
values::MediaTypeHtml, values::MediaTypeHtml,
}; };
use lemmy_db_schema::{ use lemmy_db_schema::{newtypes::CommentId, source::post::Post, traits::Crud};
newtypes::CommentId,
source::{community::Community, post::Post},
traits::Crud,
};
use lemmy_utils::LemmyError; use lemmy_utils::LemmyError;
use lemmy_websocket::LemmyContext; use lemmy_websocket::LemmyContext;
use serde::{Deserialize, Serialize}; use serde::{Deserialize, Serialize};
@ -101,24 +96,6 @@ impl ActivityHandler for Note {
Err(anyhow!("Announce/Page can only be sent, not received").into()) Err(anyhow!("Announce/Page can only be sent, not received").into())
} }
async fn receive(self, _: &Data<Self::DataType>, _: &mut i32) -> Result<(), LemmyError> { async fn receive(self, _: &Data<Self::DataType>, _: &mut i32) -> Result<(), LemmyError> {
Ok(()) unimplemented!()
}
}
#[async_trait::async_trait(?Send)]
impl GetCommunity for Note {
async fn get_community(
&self,
context: &LemmyContext,
request_counter: &mut i32,
) -> Result<ApubCommunity, LemmyError> {
let post = self.get_parents(context, request_counter).await?.0;
Ok(
blocking(context.pool(), move |conn| {
Community::read(conn, post.community_id)
})
.await??
.into(),
)
} }
} }

View File

@ -1,5 +1,4 @@
use crate::{ use crate::{
activities::community::announce::GetCommunity,
objects::{community::ApubCommunity, person::ApubPerson, post::ApubPost}, objects::{community::ApubCommunity, person::ApubPerson, post::ApubPost},
protocol::{ImageObject, Source}, protocol::{ImageObject, Source},
}; };
@ -88,17 +87,6 @@ impl ActivityHandler for Page {
Err(anyhow!("Announce/Page can only be sent, not received").into()) Err(anyhow!("Announce/Page can only be sent, not received").into())
} }
async fn receive(self, _: &Data<Self::DataType>, _: &mut i32) -> Result<(), LemmyError> { async fn receive(self, _: &Data<Self::DataType>, _: &mut i32) -> Result<(), LemmyError> {
Ok(()) unimplemented!()
}
}
#[async_trait::async_trait(?Send)]
impl GetCommunity for Page {
async fn get_community(
&self,
context: &LemmyContext,
request_counter: &mut i32,
) -> Result<ApubCommunity, LemmyError> {
self.extract_community(context, request_counter).await
} }
} }