This commit is contained in:
Riley Davis
2017-01-23 16:56:44 -07:00
parent 6282c39f3a
commit fa4c6e8ec5
5 changed files with 15 additions and 10 deletions
+1
View File
@@ -8,6 +8,7 @@
import React, {PropTypes} from 'react';
import PermalinkButton from 'coral-plugin-permalinks/PermalinkButton';
// import AuthorName from '../../coral-plugin-author-name/AuthorName';
import Content from '../../coral-plugin-commentcontent/CommentContent';
import PubDate from '../../coral-plugin-pubdate/PubDate';
+1
View File
@@ -1,4 +1,5 @@
import React, {Component, PropTypes} from 'react';
// import Pym from 'pym.js';
import {compose} from 'react-apollo';
import {connect} from 'react-redux';
@@ -5,7 +5,7 @@ import DELETE_ACTION from './deleteAction.graphql';
export const postComment = graphql(POST_COMMENT, {
props: ({mutate}) => ({
postItem: ({asset_id, body, parent_id} /*, type */) => {
postItem: ({asset_id, body, parent_id} /* , type */ ) => {
return mutate({
variables: {
asset_id,
+10 -5
View File
@@ -8,12 +8,13 @@ const name = 'coral-plugin-commentbox';
class CommentBox extends Component {
static propTypes = {
postItem: PropTypes.func.isRequired,
// updateItem: PropTypes.func,
// comments: PropTypes.array,
postItem: PropTypes.func.isRequired,
assetId: PropTypes.string.isRequired,
parentId: PropTypes.string,
authorId: PropTypes.string.isRequired,
// comments: PropTypes.array,
isReply: PropTypes.bool.isRequired,
canPost: PropTypes.bool,
currentUser: PropTypes.object
@@ -26,13 +27,14 @@ class CommentBox extends Component {
postComment = () => {
const {
postItem,
// child_id,
// updateItem,
// appendItemArray,
postItem,
assetId,
parentId,
// child_id,
addNotification,
// appendItemArray,
authorId
} = this.props;
@@ -44,6 +46,7 @@ class CommentBox extends Component {
};
console.log('CommentBox.parentId', parentId);
// let related;
// let parent_type;
// if (parent_id) {
@@ -64,12 +67,14 @@ class CommentBox extends Component {
postItem(comment, 'comments')
.then(({data}) => {
const postedComment = data.createComment;
// const commentId = postedComment.id;
if (postedComment.status === 'rejected') {
addNotification('error', lang.t('comment-post-banned-word'));
} else if (postedComment.status === 'PREMOD') {
addNotification('success', lang.t('comment-post-notif-premod'));
} else {
// appendItemArray(parent_id || id, related, commentId, !parent_id, parent_type);
addNotification('success', 'Your comment has been posted.');
}
+2 -4
View File
@@ -4,7 +4,7 @@ import translations from './translations.json';
const name = 'coral-plugin-replies';
const ReplyButton = ({banned, parentCommentId, currentUserId, onClick}) => {
const ReplyButton = ({banned, onClick}) => {
return (
<button
className={`${name}-reply-button`}
@@ -18,9 +18,7 @@ const ReplyButton = ({banned, parentCommentId, currentUserId, onClick}) => {
ReplyButton.propTypes = {
onClick: PropTypes.func.isRequired,
banned: PropTypes.bool.isRequired,
parentCommentId: PropTypes.string.isRequired,
currentUserId: PropTypes.string.isRequired
banned: PropTypes.bool.isRequired
};
export default ReplyButton;