Port PostDontAgree mutation

This commit is contained in:
Chi Vinh Le
2017-05-08 22:56:01 +07:00
parent 10796ed4b3
commit 83ef41000c
4 changed files with 34 additions and 26 deletions
@@ -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, withPostFlag, postDontAgree, deleteAction, addCommentTag, removeCommentTag, ignoreUser} from 'coral-framework/graphql/mutations';
import {withPostComment, withPostFlag, withPostDontAgree, 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';
@@ -238,7 +238,7 @@ export default compose(
connect(mapStateToProps, mapDispatchToProps),
withPostComment,
withPostFlag,
postDontAgree,
withPostDontAgree,
addCommentTag,
removeCommentTag,
ignoreUser,
+14 -2
View File
@@ -11,7 +11,18 @@ const config = {
errors {
translation_key
}
}`,
}
`,
CreateDontAgreeResponse : gql`
fragment CoralEmbedStream_CreateDontAgreeResponse on CreateDontAgreeResponse {
dontagree {
id
}
errors {
translation_key
}
}
`,
CreateCommentResponse: gql`
fragment CoralEmbedStream_CreateCommentResponse on CreateCommentResponse {
comment {
@@ -45,7 +56,8 @@ const config = {
created_at
}
}
}`,
}
`,
},
mutations: {
PostComment: ({
@@ -1,5 +1,4 @@
import {graphql, gql} from 'react-apollo';
import POST_DONT_AGREE from './postDontAgree.graphql';
import DELETE_ACTION from './deleteAction.graphql';
import ADD_COMMENT_TAG from './addCommentTag.graphql';
import REMOVE_COMMENT_TAG from './removeCommentTag.graphql';
@@ -28,7 +27,7 @@ export const withPostComment = withMutation(
export const withPostFlag = withMutation(
gql`
mutation CreateFlag($flag: CreateFlagInput!) {
mutation PostFlag($flag: CreateFlagInput!) {
createFlag(flag: $flag) {
...CreateFlagResponse
}
@@ -44,16 +43,23 @@ export const withPostFlag = withMutation(
}}),
});
export const postDontAgree = graphql(POST_DONT_AGREE, {
props: ({mutate}) => ({
postDontAgree: (dontagree) => {
return mutate({
variables: {
dontagree
}
});
}}),
});
export const withPostDontAgree = withMutation(
gql`
mutation CreateDontAgree($dontagree: CreateDontAgreeInput!) {
createDontAgree(dontagree: $dontagree) {
...CreateDontAgreeResponse
}
}
`, {
props: ({mutate}) => ({
postDontAgree: (dontagree) => {
return mutate({
variables: {
dontagree
}
});
}}),
});
export const deleteAction = graphql(DELETE_ACTION, {
props: ({mutate}) => ({
@@ -1,10 +0,0 @@
mutation CreateDontAgree($dontagree: CreateDontAgreeInput!) {
createDontAgree(dontagree:$dontagree) {
dontagree {
id
}
errors {
translation_key
}
}
}