Merge branch 'graphql' of github.com:coralproject/talk into graphql

This commit is contained in:
David Jay
2017-01-24 14:19:58 -05:00
60 changed files with 1845 additions and 2512 deletions
+1 -1
View File
@@ -11,7 +11,7 @@ export const checkLogin = () => dispatch => {
dispatch(checkLoginRequest());
coralApi('/auth')
.then(result => {
const isAdmin = !!result.user.roles.filter(i => i === 'admin').length;
const isAdmin = !!result.user.roles.filter(i => i === 'ADMIN').length;
dispatch(checkLoginSuccess(result.user, isAdmin));
})
.catch(error => dispatch(checkLoginFailure(error)));
+1 -1
View File
@@ -132,7 +132,7 @@ class Comment extends React.Component {
{
this.state.replyBoxVisible
? <ReplyBox
replyPostedHandler={() => {
commentPostedHandler={() => {
console.log('replyPostedHandler');
this.setState({replyBoxVisible: false});
refetch();
+1 -1
View File
@@ -120,7 +120,7 @@ class Embed extends Component {
{
user
? <CommentBox
refetch={refetch}
commentPostedHandler={refetch}
addNotification={this.props.addNotification}
postItem={this.props.postItem}
appendItemArray={this.props.appendItemArray}
@@ -1,3 +1,3 @@
import Pym from 'pym.js';
import Pym from '../../../node_modules/pym.js';
export default new Pym.Child({polling: 100});
+2 -2
View File
@@ -27,7 +27,7 @@ export const fetchSignIn = (formData) => (dispatch) => {
dispatch(signInRequest());
coralApi('/auth/local', {method: 'POST', body: formData})
.then(({user}) => {
const isAdmin = !!user.roles.filter(i => i === 'admin').length;
const isAdmin = !!user.roles.filter(i => i === 'ADMIN').length;
dispatch(signInSuccess(user, isAdmin));
dispatch(hideSignInDialog());
dispatch(addItem(user, 'users'));
@@ -132,7 +132,7 @@ export const checkLogin = () => dispatch => {
throw new Error('Not logged in');
}
const isAdmin = !!result.user.roles.filter(i => i === 'admin').length;
const isAdmin = !!result.user.roles.filter(i => i === 'ADMIN').length;
dispatch(checkLoginSuccess(result.user, isAdmin));
})
.catch(error => dispatch(checkLoginFailure(error)));
+4 -4
View File
@@ -11,7 +11,7 @@ class CommentBox extends Component {
// updateItem: PropTypes.func,
// comments: PropTypes.array,
replyPostedHandler: PropTypes.func,
commentPostedHandler: PropTypes.func,
postItem: PropTypes.func.isRequired,
assetId: PropTypes.string.isRequired,
parentId: PropTypes.string,
@@ -32,7 +32,7 @@ class CommentBox extends Component {
// child_id,
// updateItem,
// appendItemArray,
replyPostedHandler,
commentPostedHandler,
postItem,
assetId,
parentId,
@@ -79,8 +79,8 @@ class CommentBox extends Component {
addNotification('success', 'Your comment has been posted.');
}
if (replyPostedHandler) {
replyPostedHandler();
if (commentPostedHandler) {
commentPostedHandler();
}
})
.catch((err) => console.error(err));
+3 -3
View File
@@ -3,10 +3,10 @@ import CommentBox from '../coral-plugin-commentbox/CommentBox';
const name = 'coral-plugin-replies';
const ReplyBox = ({styles, postItem, assetId, authorId, addNotification, parentId, replyPostedHandler}) => (
const ReplyBox = ({styles, postItem, assetId, authorId, addNotification, parentId, commentPostedHandler}) => (
<div className={`${name}-textarea`} style={styles && styles.container}>
<CommentBox
replyPostedHandler={replyPostedHandler}
commentPostedHandler={commentPostedHandler}
parentId={parentId}
addNotification={addNotification}
authorId={authorId}
@@ -17,7 +17,7 @@ const ReplyBox = ({styles, postItem, assetId, authorId, addNotification, parentI
);
ReplyBox.propTypes = {
replyPostedHandler: PropTypes.func,
commentPostedHandler: PropTypes.func,
parentId: PropTypes.string,
addNotification: PropTypes.func.isRequired,
authorId: PropTypes.string.isRequired,