mirror of
https://github.com/wassname/talk.git
synced 2026-06-29 23:26:19 +08:00
Merge branch '142993479-tags' of github.com:coralproject/talk into 142993479-tags
This commit is contained in:
@@ -1,23 +1,19 @@
|
||||
import {gql} from 'react-apollo';
|
||||
import * as mutations from './mutations';
|
||||
|
||||
function createDefaultResponseFragments() {
|
||||
const names = Object.keys(mutations).map((key) => key.replace('with', ''));
|
||||
const result = {};
|
||||
names.forEach((name) => {
|
||||
const response = `${name}Response`;
|
||||
result[response] = gql`
|
||||
fragment Coral_${response} on ${response} {
|
||||
errors {
|
||||
translation_key
|
||||
}
|
||||
}
|
||||
`;
|
||||
});
|
||||
return result;
|
||||
}
|
||||
import {createDefaultResponseFragments} from '../utils';
|
||||
|
||||
// fragments defined here are automatically registered.
|
||||
export default {
|
||||
...createDefaultResponseFragments()
|
||||
...createDefaultResponseFragments(
|
||||
'SetCommentStatusResponse',
|
||||
'SuspendUserResponse',
|
||||
'RejectUsernameResponse',
|
||||
'SetUserStatusResponse',
|
||||
'PostCommentResponse',
|
||||
'EditCommentResponse',
|
||||
'PostFlagResponse',
|
||||
'CreateDontAgreeResponse',
|
||||
'DeleteActionResponse',
|
||||
'ModifyTagResponse',
|
||||
'IgnoreUserResponse',
|
||||
'StopIgnoringUserResponse',
|
||||
)
|
||||
};
|
||||
|
||||
@@ -112,3 +112,18 @@ export function getResponseErrors(mutationResult) {
|
||||
});
|
||||
return result.length ? result : false;
|
||||
}
|
||||
|
||||
export function createDefaultResponseFragments(...names) {
|
||||
const result = {};
|
||||
names.forEach((name) => {
|
||||
const response = `${name}Response`;
|
||||
result[response] = gql`
|
||||
fragment Coral_${response} on ${response} {
|
||||
errors {
|
||||
translation_key
|
||||
}
|
||||
}
|
||||
`;
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ type CreateLikeResponse implements Response {
|
||||
like: LikeAction
|
||||
|
||||
# An array of errors relating to the mutation that occurred.
|
||||
errors: [UserError]
|
||||
errors: [UserError!]
|
||||
}
|
||||
|
||||
type RootMutation {
|
||||
|
||||
@@ -60,7 +60,7 @@ type CreateLoveResponse implements Response {
|
||||
love: LoveAction
|
||||
|
||||
# An array of errors relating to the mutation that occurred.
|
||||
errors: [UserError]
|
||||
errors: [UserError!]
|
||||
}
|
||||
|
||||
type RootMutation {
|
||||
|
||||
Reference in New Issue
Block a user