diff --git a/client/coral-embed-stream/src/containers/Stream.js b/client/coral-embed-stream/src/containers/Stream.js index 08adbd930..880098388 100644 --- a/client/coral-embed-stream/src/containers/Stream.js +++ b/client/coral-embed-stream/src/containers/Stream.js @@ -6,7 +6,7 @@ import uniqBy from 'lodash/uniqBy'; import sortBy from 'lodash/sortBy'; import isNil from 'lodash/isNil'; import {NEW_COMMENT_COUNT_POLL_INTERVAL} from '../constants/stream'; -import {withPostComment, postFlag, postDontAgree, deleteAction, addCommentTag, removeCommentTag, ignoreUser} from 'coral-framework/graphql/mutations'; +import {withPostComment, withPostFlag, postDontAgree, deleteAction, addCommentTag, removeCommentTag, ignoreUser} from 'coral-framework/graphql/mutations'; import {notificationActions, authActions} from 'coral-framework'; import {editName} from 'coral-framework/actions/user'; import {setCommentCountCache, setActiveReplyBox} from '../actions/stream'; @@ -237,7 +237,7 @@ export default compose( withFragments(fragments), connect(mapStateToProps, mapDispatchToProps), withPostComment, - postFlag, + withPostFlag, postDontAgree, addCommentTag, removeCommentTag, diff --git a/client/coral-embed-stream/src/graphql/index.js b/client/coral-embed-stream/src/graphql/index.js index 2d6f943a2..5add9eb30 100644 --- a/client/coral-embed-stream/src/graphql/index.js +++ b/client/coral-embed-stream/src/graphql/index.js @@ -3,8 +3,17 @@ import {registerConfig} from 'coral-framework/services/registry'; const config = { fragments: { + CreateFlagResponse: gql` + fragment CoralEmbedStream_CreateFlagResponse on CreateFlagResponse { + flag { + id + } + errors { + translation_key + } + }`, CreateCommentResponse: gql` - fragment Coral_CreateCommentResponse on CreateCommentResponse { + fragment CoralEmbedStream_CreateCommentResponse on CreateCommentResponse { comment { ...Coral_CreateCommentResponse_Comment replies { @@ -16,7 +25,7 @@ const config = { } } - fragment Coral_CreateCommentResponse_Comment on Comment { + fragment CoralEmbedStream_CreateCommentResponse_Comment on Comment { id body created_at diff --git a/client/coral-framework/graphql/mutations/index.js b/client/coral-framework/graphql/mutations/index.js index dbc8f100e..430145122 100644 --- a/client/coral-framework/graphql/mutations/index.js +++ b/client/coral-framework/graphql/mutations/index.js @@ -1,5 +1,4 @@ import {graphql, gql} from 'react-apollo'; -import POST_FLAG from './postFlag.graphql'; import POST_DONT_AGREE from './postDontAgree.graphql'; import DELETE_ACTION from './deleteAction.graphql'; import ADD_COMMENT_TAG from './addCommentTag.graphql'; @@ -27,16 +26,23 @@ export const withPostComment = withMutation( }), }); -export const postFlag = graphql(POST_FLAG, { - props: ({mutate}) => ({ - postFlag: (flag) => { - return mutate({ - variables: { - flag - } - }); - }}), -}); +export const withPostFlag = withMutation( + gql` + mutation CreateFlag($flag: CreateFlagInput!) { + createFlag(flag: $flag) { + ...CreateFlagResponse + } + } + `, { + props: ({mutate}) => ({ + postFlag: (flag) => { + return mutate({ + variables: { + flag + } + }); + }}), + }); export const postDontAgree = graphql(POST_DONT_AGREE, { props: ({mutate}) => ({ diff --git a/client/coral-framework/graphql/mutations/postFlag.graphql b/client/coral-framework/graphql/mutations/postFlag.graphql deleted file mode 100644 index cabc2feef..000000000 --- a/client/coral-framework/graphql/mutations/postFlag.graphql +++ /dev/null @@ -1,10 +0,0 @@ -mutation CreateFlag($flag: CreateFlagInput!) { - createFlag(flag:$flag) { - flag { - id - } - errors { - translation_key - } - } -}