mirror of
https://github.com/wassname/talk.git
synced 2026-07-08 15:45:09 +08:00
Port StopIgnoringUser Mutation
This commit is contained in:
@@ -3,6 +3,13 @@ import {registerConfig} from 'coral-framework/services/registry';
|
||||
|
||||
const config = {
|
||||
fragments: {
|
||||
StopIgnoringUserResponse: gql`
|
||||
fragment CoralEmbedStream_StopIgnoringUserResponse on StopIgnoringUserResponse {
|
||||
errors {
|
||||
translation_key
|
||||
}
|
||||
}
|
||||
`,
|
||||
IgnoreUserResponse: gql`
|
||||
fragment CoralEmbedStream_IgnoreUserResponse on IgnoreUserResponse {
|
||||
errors {
|
||||
@@ -107,6 +114,13 @@ const config = {
|
||||
'EmbedQuery', 'myIgnoredUsers',
|
||||
],
|
||||
}),
|
||||
StopIgnoringUser: () => ({
|
||||
|
||||
// TODO: don't rely on refetching.
|
||||
refetchQueries: [
|
||||
'EmbedQuery', 'myIgnoredUsers',
|
||||
],
|
||||
}),
|
||||
PostComment: ({
|
||||
variables: {comment: {asset_id, body, parent_id, tags = []}},
|
||||
state: {auth},
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
import {graphql, gql} from 'react-apollo';
|
||||
import STOP_IGNORING_USER from './stopIgnoringUser.graphql';
|
||||
import {gql} from 'react-apollo';
|
||||
import withMutation from '../../hocs/withMutation';
|
||||
|
||||
export const withPostComment = withMutation(
|
||||
@@ -131,20 +130,21 @@ export const withIgnoreUser = withMutation(
|
||||
}}),
|
||||
});
|
||||
|
||||
// TODO: don't rely on refetching.
|
||||
export const stopIgnoringUser = graphql(STOP_IGNORING_USER, {
|
||||
props: ({mutate}) => {
|
||||
return {
|
||||
export const withStopIgnoringUser = withMutation(
|
||||
gql`
|
||||
mutation StopIgnoringUser($id: ID!) {
|
||||
stopIgnoringUser(id:$id) {
|
||||
...StopIgnoringUserResponse
|
||||
}
|
||||
}
|
||||
`, {
|
||||
props: ({mutate}) => ({
|
||||
stopIgnoringUser: ({id}) => {
|
||||
return mutate({
|
||||
variables: {
|
||||
id,
|
||||
},
|
||||
refetchQueries: [
|
||||
'EmbedQuery', 'myIgnoredUsers',
|
||||
]
|
||||
});
|
||||
}
|
||||
};
|
||||
}
|
||||
});
|
||||
}}),
|
||||
});
|
||||
|
||||
|
||||
@@ -1,7 +0,0 @@
|
||||
mutation stopIgnoringUser ($id: ID!) {
|
||||
stopIgnoringUser(id:$id) {
|
||||
errors {
|
||||
translation_key
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,7 +5,7 @@ import I18n from 'coral-framework/modules/i18n/i18n';
|
||||
import {bindActionCreators} from 'redux';
|
||||
|
||||
import {myCommentHistory, myIgnoredUsers} from 'coral-framework/graphql/queries';
|
||||
import {stopIgnoringUser} from 'coral-framework/graphql/mutations';
|
||||
import {withStopIgnoringUser} from 'coral-framework/graphql/mutations';
|
||||
|
||||
import {link} from 'coral-framework/services/PymConnection';
|
||||
import NotLoggedIn from '../components/NotLoggedIn';
|
||||
@@ -101,5 +101,5 @@ export default compose(
|
||||
connect(mapStateToProps, mapDispatchToProps),
|
||||
myCommentHistory,
|
||||
myIgnoredUsers,
|
||||
stopIgnoringUser,
|
||||
withStopIgnoringUser,
|
||||
)(ProfileContainer);
|
||||
|
||||
Reference in New Issue
Block a user