AddModToCommunity,
BanFromCommunity,
BanPerson,
+ BlockPerson,
CommentView,
CommunityModeratorView,
CreateCommentLike,
)}
</button>
)}
- {UserService.Instance.localUserView && !this.props.viewOnly && (
+ {UserService.Instance.myUserInfo && !this.props.viewOnly && (
<>
<button
className={`btn btn-link btn-animate ${
) : (
<>
{!this.myComment && (
- <button class="btn btn-link btn-animate">
- <Link
- className="text-muted"
- to={`/create_private_message/recipient/${cv.creator.id}`}
- title={i18n.t("message").toLowerCase()}
+ <>
+ <button class="btn btn-link btn-animate">
+ <Link
+ className="text-muted"
+ to={`/create_private_message/recipient/${cv.creator.id}`}
+ title={i18n.t("message").toLowerCase()}
+ >
+ <Icon icon="mail" />
+ </Link>
+ </button>
+ <button
+ class="btn btn-link btn-animate text-muted"
+ onClick={linkEvent(
+ this,
+ this.handleBlockUserClick
+ )}
+ data-tippy-content={i18n.t("block_user")}
+ aria-label={i18n.t("block_user")}
>
- <Icon icon="mail" />
- </Link>
- </button>
+ <Icon icon="slash" />
+ </button>
+ </>
)}
<button
class="btn btn-link btn-animate text-muted"
get myComment(): boolean {
return (
this.props.node.comment_view.creator.id ==
- UserService.Instance.localUserView?.person.id
+ UserService.Instance.myUserInfo?.local_user_view.person.id
);
}
.concat(this.props.moderators.map(m => m.moderator.id));
return canMod(
- UserService.Instance.localUserView,
+ UserService.Instance.myUserInfo,
adminsThenMods,
this.props.node.comment_view.creator.id
);
return (
this.props.admins &&
canMod(
- UserService.Instance.localUserView,
+ UserService.Instance.myUserInfo,
this.props.admins.map(a => a.person.id),
this.props.node.comment_view.creator.id
)
get amCommunityCreator(): boolean {
return (
this.props.moderators &&
- UserService.Instance.localUserView &&
+ UserService.Instance.myUserInfo &&
this.props.node.comment_view.creator.id !=
- UserService.Instance.localUserView.person.id &&
- UserService.Instance.localUserView.person.id ==
+ UserService.Instance.myUserInfo.local_user_view.person.id &&
+ UserService.Instance.myUserInfo.local_user_view.person.id ==
this.props.moderators[0].moderator.id
);
}
get amSiteCreator(): boolean {
return (
this.props.admins &&
- UserService.Instance.localUserView &&
+ UserService.Instance.myUserInfo &&
this.props.node.comment_view.creator.id !=
- UserService.Instance.localUserView.person.id &&
- UserService.Instance.localUserView.person.id ==
+ UserService.Instance.myUserInfo.local_user_view.person.id &&
+ UserService.Instance.myUserInfo.local_user_view.person.id ==
this.props.admins[0].person.id
);
}
i.setState(i.state);
}
+ handleBlockUserClick(i: CommentNode) {
+ let blockUserForm: BlockPerson = {
+ person_id: i.props.node.comment_view.creator.id,
+ block: true,
+ auth: authField(),
+ };
+ WebSocketService.Instance.send(wsClient.blockPerson(blockUserForm));
+ }
+
handleDeleteClick(i: CommentNode) {
let comment = i.props.node.comment_view.comment;
let deleteForm: DeleteComment = {