From 4a5787b40e643d7dfbf2cd3ccf657d98d8d8f609 Mon Sep 17 00:00:00 2001 From: Dessalines Date: Wed, 11 Aug 2021 11:30:23 -0400 Subject: [PATCH] Adding BlockCommunityResponse --- crates/api/src/community.rs | 9 ++++++--- crates/api_common/src/community.rs | 6 ++++++ 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/crates/api/src/community.rs b/crates/api/src/community.rs index 9e8caa1214..88bce66fa7 100644 --- a/crates/api/src/community.rs +++ b/crates/api/src/community.rs @@ -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, _websocket_id: Option, - ) -> Result { + ) -> Result { 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, + }) } } diff --git a/crates/api_common/src/community.rs b/crates/api_common/src/community.rs index 2a62a3c4ed..68ba2ff68a 100644 --- a/crates/api_common/src/community.rs +++ b/crates/api_common/src/community.rs @@ -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,