diff --git a/client/coral-framework/graphql/mutations/index.js b/client/coral-framework/graphql/mutations/index.js index a67b728e6..16bac9b1a 100644 --- a/client/coral-framework/graphql/mutations/index.js +++ b/client/coral-framework/graphql/mutations/index.js @@ -14,14 +14,12 @@ export const postComment = graphql(POST_COMMENT, { fragments: commentView }), props: ({ownProps, mutate}) => ({ - postItem: ({asset_id, body, parent_id}) => - mutate({ + postItem: comment => { + const {asset_id, body, parent_id, tags = []} = comment; + + return mutate({ variables: { - comment: { - asset_id, - body, - parent_id - } + comment }, optimisticResponse: { createComment: { @@ -35,14 +33,14 @@ export const postComment = graphql(POST_COMMENT, { parent_id, asset_id, action_summaries: [], - tags: [], + tags, status: null, id: 'pending' } } }, updateQueries: { - AssetQuery: (oldData, {mutationResult:{data:{createComment:{comment}}}}) => { + AssetQuery: (oldData, {mutationResult: {data: {createComment: {comment}}}}) => { if (oldData.asset.settings.moderation === 'PRE' || comment.status === 'PREMOD' || comment.status === 'REJECTED') { return oldData; @@ -58,8 +56,8 @@ export const postComment = graphql(POST_COMMENT, { ...oldData.asset, comments: oldData.asset.comments.map((oldComment) => { return oldComment.id === parent_id - ? {...oldComment, replies: [...oldComment.replies, comment]} - : oldComment; + ? {...oldComment, replies: [...oldComment.replies, comment]} + : oldComment; }) } }; @@ -80,6 +78,7 @@ export const postComment = graphql(POST_COMMENT, { } } }) + } }), }); diff --git a/client/coral-plugin-commentbox/CommentBox.js b/client/coral-plugin-commentbox/CommentBox.js index bde684d2c..e2a139146 100644 --- a/client/coral-plugin-commentbox/CommentBox.js +++ b/client/coral-plugin-commentbox/CommentBox.js @@ -45,7 +45,6 @@ class CommentBox extends Component { let comment = { body: this.state.body, asset_id: assetId, - author_id: authorId, parent_id: parentId }; diff --git a/out.gif b/out.gif new file mode 100644 index 000000000..e69de29bb