mirror of
https://github.com/wassname/talk.git
synced 2026-07-23 13:10:20 +08:00
Port PostFlag mutation
This commit is contained in:
@@ -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,
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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}) => ({
|
||||
|
||||
@@ -1,10 +0,0 @@
|
||||
mutation CreateFlag($flag: CreateFlagInput!) {
|
||||
createFlag(flag:$flag) {
|
||||
flag {
|
||||
id
|
||||
}
|
||||
errors {
|
||||
translation_key
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user