Fix blocking (#381)

* fix blocked user appears unblocked after refresh

* modify comment rendering to temporary blocking
This commit is contained in:
Misha Vyrtsev
2019-07-22 19:05:02 -05:00
committed by Umputun
parent 7103dbb589
commit 4d7699ec5e
2 changed files with 7 additions and 10 deletions
+6 -9
View File
@@ -454,15 +454,12 @@ export class Comment extends Component<Props, State> {
const o = {
...props.data,
controversyText: `Controversy: ${(props.data.controversy || 0).toFixed(2)}`,
text: props.data.text.length
? props.view === 'preview'
text:
props.view === 'preview'
? getTextSnippet(props.data.text)
: props.data.text
: this.props.isUserBanned
? 'This user was blocked'
: props.data.delete
? 'This comment was deleted'
: props.data.text,
: props.data.delete
? 'This comment was deleted'
: props.data.text,
time: formatTime(new Date(props.data.time)),
orig: isEditing
? props.data.orig &&
@@ -587,7 +584,7 @@ export class Comment extends Component<Props, State> {
</a>
)}
{isAdmin && props.isUserBanned && props.view !== 'user' && <span className="comment__status">Blocked</span>}
{props.isUserBanned && props.view !== 'user' && <span className="comment__status">Blocked</span>}
{isAdmin && !props.isUserBanned && props.data.delete && <span className="comment__status">Deleted</span>}
@@ -40,7 +40,7 @@ const mapStateToProps = (state: StoreState, cprops: { data: CommentType }) => {
> = {
editMode: getCommentMode(state, cprops.data.id),
user: state.user,
isUserBanned: state.bannedUsers.find(u => u.id === cprops.data.user.id) !== undefined,
isUserBanned: cprops.data.user.block || state.bannedUsers.find(u => u.id === cprops.data.user.id) !== undefined,
post_info: state.info,
isCommentsDisabled: state.info.read_only || false,
theme: state.theme,