Adding block from community sidebar. Fixes #690 (#716)

* Adding block from community sidebar. Fixes #690

* Fixing lint
This commit is contained in:
Dessalines 2022-07-29 23:38:37 -04:00 committed by GitHub
parent b2cab8d126
commit e68babe38b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 62 additions and 13 deletions

View file

@ -3,6 +3,7 @@ import { Component, linkEvent } from "inferno";
import {
AddModToCommunityResponse,
BanFromCommunityResponse,
BlockCommunityResponse,
BlockPersonResponse,
CommentReportResponse,
CommentResponse,
@ -53,6 +54,7 @@ import {
setupTippy,
showLocal,
toast,
updateCommunityBlock,
updatePersonBlock,
wsClient,
wsSubscribe,
@ -663,6 +665,17 @@ export class Community extends Component<any, State> {
toast(i18n.t("purge_success"));
this.context.router.history.push(`/`);
}
} else if (op == UserOperation.BlockCommunity) {
let data = wsJsonToRes<BlockCommunityResponse>(
msg,
BlockCommunityResponse
);
this.state.communityRes.match({
some: res => (res.community_view.blocked = data.blocked),
none: void 0,
});
updateCommunityBlock(data);
this.setState(this.state);
}
}
}