diff --git a/web/app/components/blocked-users/blocked-users.jsx b/web/app/components/blocked-users/blocked-users.jsx index 7d0d84a9..ead8a501 100644 --- a/web/app/components/blocked-users/blocked-users.jsx +++ b/web/app/components/blocked-users/blocked-users.jsx @@ -19,6 +19,8 @@ export default class BlockedUsers extends Component { if (confirm('Do you want to block this user?')) { api.blockUser({ id: user.id }).then(() => { this.setState({ unblockedUsers: this.state.unblockedUsers.filter(x => x !== user.id) }); + + if (this.props.onUnblock) this.props.onUnblock(user.id); }); } } @@ -27,6 +29,8 @@ export default class BlockedUsers extends Component { if (confirm('Do you want to unblock this user?')) { api.unblockUser({ id: user.id }).then(() => { this.setState({ unblockedUsers: this.state.unblockedUsers.concat([user.id]) }); + + if (this.props.onUnblock) this.props.onUnblock(user.id); }); } } diff --git a/web/app/components/root/root.jsx b/web/app/components/root/root.jsx index ea6f1e81..e576a7ff 100644 --- a/web/app/components/root/root.jsx +++ b/web/app/components/root/root.jsx @@ -106,7 +106,19 @@ export default class Root extends Component { } onBlockedUsersHide() { - this.setState({ isBlockedVisible: false }); + // if someone was unblocked let's reload comments + if (this.state.wasSomeoneUnblocked) { + api.find({ url }).then(({ comments } = {}) => store.set('comments', comments)); + } + + this.setState({ + isBlockedVisible: false, + wasSomeoneUnblocked: false, + }); + } + + onUnblockSomeone() { + this.setState({ wasSomeoneUnblocked: true }); } addComment(data) { @@ -197,7 +209,7 @@ export default class Root extends Component { { isBlockedVisible && (