decrease opacity of comments of banned users

This commit is contained in:
igoradamenko
2018-02-13 01:15:09 +02:00
parent 115917b0d2
commit 94244f9751
5 changed files with 21 additions and 11 deletions
@@ -1,6 +1,6 @@
@import 'common/variables';
.comment_marked {
.comment_pinned {
&, &.comment_view_admin {
.comment__username {
font-weight: 700;
@@ -0,0 +1,5 @@
.comment_useless {
.comment__body {
opacity: .35;
}
}
+11 -8
View File
@@ -71,28 +71,30 @@ export default class Comment extends Component {
}
onBlockClick() {
const { user: { id } } = this.props.data;
const { id, user: { id: userId } } = this.props.data;
this.setState({ userBlocked: true });
api.blockUser({ id });
api.blockUser({ id: userId }).then(() => {
api.getComment({ id }).then(comment => store.replaceComment(comment));
});
}
onUnblockClick() {
const { user: { id } } = this.props.data;
const { id, user: { id: userId } } = this.props.data;
this.setState({ userBlocked: false });
api.unblockUser({ id });
api.unblockUser({ id: userId }).then(() => {
api.getComment({ id }).then(comment => store.replaceComment(comment));
});
}
onDeleteClick() {
const { id } = this.props.data;
api.remove({ id }).then(() => {
if (this.props.onDelete) {
this.props.onDelete();
}
api.getComment({ id }).then(comment => store.replaceComment(comment));
});
}
@@ -156,7 +158,8 @@ export default class Comment extends Component {
};
const defaultMods = {
marked: mods.pinned ? null : pinned,
pinned,
useless: userBlocked,
// TODO: add default view mod or don't?
view: o.user.admin ? 'admin' : null,
};
+3 -1
View File
@@ -25,6 +25,8 @@ require('./__vote/_type/_up/comment__vote_type_up.scss');
require('./_level/comment_level.scss');
require('./_marked/comment_marked.scss');
require('./_pinned/comment_pinned.scss');
require('./_useless/comment_useless.scss');
require('./_view/_admin/comment_view_admin.scss');
+1 -1
View File
@@ -67,7 +67,7 @@ export default class Root extends Component {
pinnedComments.map(comment => (
<Comment
data={comment}
mods={{ level: 0, pinned: true }}
mods={{ level: 0 }}
mix="root__pinned-comment"
/>
))