Merge branch 'master' into empty-states

This commit is contained in:
Kim Gardner
2017-02-23 16:15:05 -05:00
committed by GitHub
3 changed files with 8 additions and 6 deletions
+1 -1
View File
@@ -9,7 +9,7 @@ const checkLoginFailure = error => ({type: actions.CHECK_LOGIN_FAILURE, error});
export const checkLogin = () => dispatch => {
dispatch(checkLoginRequest());
coralApi('/auth')
return coralApi('/auth')
.then(result => {
const isAdmin = !!result.user.roles.filter(i => i === 'ADMIN').length;
dispatch(checkLoginSuccess(result.user, isAdmin));
@@ -8,7 +8,11 @@ import {PermissionRequired} from '../components/PermissionRequired';
class LayoutContainer extends Component {
componentWillMount () {
const {checkLogin} = this.props;
checkLogin();
checkLogin().then(() => {
if (!this.props.auth.isAdmin) {
location.href = '/admin/login';
}
});
}
render () {
const {isAdmin, loggedIn, loadingUser} = this.props.auth;
+2 -4
View File
@@ -150,10 +150,8 @@ const createPublicComment = (context, commentInput) => {
item_id: comment.id,
item_type: 'COMMENTS',
action_type: 'FLAG',
metadata: {
field: 'body',
details: 'Matched suspect word filters.'
}
group_id: 'Matched suspect word filter',
metadata: {}
})
.then(() => comment);
}