Adding BlockCommunityResponse

This commit is contained in:
Dessalines 2021-08-11 11:30:23 -04:00
parent 32062ecfab
commit 84288d7ad4
2 changed files with 12 additions and 3 deletions

View file

@ -111,13 +111,13 @@ impl Perform for FollowCommunity {
#[async_trait::async_trait(?Send)]
impl Perform for BlockCommunity {
type Response = CommunityResponse;
type Response = BlockCommunityResponse;
async fn perform(
&self,
context: &Data<LemmyContext>,
_websocket_id: Option<ConnectionId>,
) -> Result<CommunityResponse, LemmyError> {
) -> Result<BlockCommunityResponse, LemmyError> {
let data: &BlockCommunity = self;
let local_user_view = get_local_user_view_from_jwt(&data.auth, context.pool()).await?;
@ -147,7 +147,10 @@ impl Perform for BlockCommunity {
})
.await??;
Ok(CommunityResponse { community_view })
Ok(BlockCommunityResponse {
blocked: data.block,
community_view,
})
}
}

View file

@ -122,6 +122,12 @@ pub struct BlockCommunity {
pub auth: String,
}
#[derive(Serialize, Clone)]
pub struct BlockCommunityResponse {
pub community_view: CommunityView,
pub blocked: bool,
}
#[derive(Deserialize)]
pub struct TransferCommunity {
pub community_id: CommunityId,