mirror of
https://github.com/wassname/talk.git
synced 2026-07-28 11:27:05 +08:00
Remove obsolete errors checking
This commit is contained in:
@@ -124,36 +124,28 @@ const extension = {
|
||||
mutations: {
|
||||
IgnoreUser: ({variables}) => ({
|
||||
updateQueries: {
|
||||
EmbedQuery: (previousData, {mutationResult}) => {
|
||||
EmbedQuery: (previousData) => {
|
||||
const ignoredUserId = variables.id;
|
||||
const response = mutationResult.data.ignoreUser;
|
||||
if (ignoredUserId && !response.errors) {
|
||||
const updated = update(previousData, {me: {ignoredUsers: {$push: [{
|
||||
id: ignoredUserId,
|
||||
__typename: 'User',
|
||||
}]}}});
|
||||
return updated;
|
||||
}
|
||||
return previousData;
|
||||
const updated = update(previousData, {me: {ignoredUsers: {$push: [{
|
||||
id: ignoredUserId,
|
||||
__typename: 'User',
|
||||
}]}}});
|
||||
return updated;
|
||||
}
|
||||
}
|
||||
}),
|
||||
StopIgnoringUser: ({variables}) => ({
|
||||
updateQueries: {
|
||||
EmbedStreamProfileQuery: (previousData, {mutationResult}) => {
|
||||
EmbedStreamProfileQuery: (previousData) => {
|
||||
const noLongerIgnoredUserId = variables.id;
|
||||
const response = mutationResult.data.stopIgnoringUser;
|
||||
if (noLongerIgnoredUserId && !response.errors) {
|
||||
|
||||
// remove noLongerIgnoredUserId from ignoredUsers
|
||||
const updated = update(previousData, {me: {ignoredUsers: {
|
||||
$apply: (ignoredUsers) => {
|
||||
return ignoredUsers.filter((u) => u.id !== noLongerIgnoredUserId);
|
||||
}
|
||||
}}});
|
||||
return updated;
|
||||
}
|
||||
return previousData;
|
||||
// remove noLongerIgnoredUserId from ignoredUsers
|
||||
const updated = update(previousData, {me: {ignoredUsers: {
|
||||
$apply: (ignoredUsers) => {
|
||||
return ignoredUsers.filter((u) => u.id !== noLongerIgnoredUserId);
|
||||
}
|
||||
}}});
|
||||
return updated;
|
||||
}
|
||||
}
|
||||
}),
|
||||
@@ -221,12 +213,7 @@ const extension = {
|
||||
variables: {id, edit},
|
||||
}) => ({
|
||||
updateQueries: {
|
||||
EmbedQuery: (previousData, {mutationResult: {data: {editComment: {comment, errors}}}}) => {
|
||||
|
||||
// @TODO (kiwi) revisit after streamlining error handling
|
||||
if (errors && errors.length) {
|
||||
return previousData;
|
||||
}
|
||||
EmbedQuery: (previousData, {mutationResult: {data: {editComment: {comment}}}}) => {
|
||||
const {status} = comment;
|
||||
const updateCommentWithEdit = (comment, edit) => {
|
||||
const {body} = edit;
|
||||
|
||||
Reference in New Issue
Block a user