-
-#[async_trait::async_trait(?Send)]
-impl GetCommunity for Delete {
- async fn get_community(
- &self,
- context: &LemmyContext,
- _request_counter: &mut i32,
- ) -> Result<ApubCommunity, LemmyError> {
- let community_id = match DeletableObjects::read_from_db(&self.object, context).await? {
- DeletableObjects::Community(c) => c.id,
- DeletableObjects::Comment(c) => {
- let post = blocking(context.pool(), move |conn| Post::read(conn, c.post_id)).await??;
- post.community_id
- }
- DeletableObjects::Post(p) => p.community_id,
- };
- let community = blocking(context.pool(), move |conn| {
- Community::read(conn, community_id)
- })
- .await??;
- Ok(community.into())
- }
-}