Skip to content

Commit

Permalink
Adding BlockCommunityResponse
Browse files Browse the repository at this point in the history
  • Loading branch information
dessalines committed Aug 11, 2021
1 parent 3e1b1a7 commit 4a5787b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
9 changes: 6 additions & 3 deletions crates/api/src/community.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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?;

Expand Down Expand Up @@ -147,7 +147,10 @@ impl Perform for BlockCommunity {
})
.await??;

Ok(CommunityResponse { community_view })
Ok(BlockCommunityResponse {
blocked: data.block,
community_view,
})
}
}

Expand Down
6 changes: 6 additions & 0 deletions crates/api_common/src/community.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit 4a5787b

Please sign in to comment.