-
-#[async_trait::async_trait(?Send)]
-impl GetCommunity for Delete {
- #[tracing::instrument(skip_all)]
- async fn get_community(
- &self,
- context: &LemmyContext,
- _request_counter: &mut i32,
- ) -> Result<ApubCommunity, LemmyError> {
- let community_id = match DeletableObjects::read_from_db(self.object.id(), context).await? {
- DeletableObjects::Community(c) => c.id,
- DeletableObjects::Comment(c) => {
- let post = Post::read(context.pool(), c.post_id).await?;
- post.community_id
- }
- DeletableObjects::Post(p) => p.community_id,
- DeletableObjects::PrivateMessage(_) => {
- return Err(anyhow!("Private message is not part of community").into())
- }
- };
- let community = Community::read(context.pool(), community_id).await?;
- Ok(community.into())
- }
-}