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

View file

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