mirror of
https://github.com/wassname/talk.git
synced 2026-07-17 11:33:39 +08:00
not pretty, but it works
This commit is contained in:
@@ -54,7 +54,20 @@ export const setCommentStatus = graphql(SET_COMMENT_STATUS, {
|
||||
},
|
||||
updateQueries: {
|
||||
ModQueue: (oldData) => {
|
||||
const comment = oldData.all.find(c => c.id === commentId);
|
||||
let comment = oldData.all.find(c => c.id === commentId);
|
||||
|
||||
if (!comment) {
|
||||
comment = oldData.premod.find(c => c.id === commentId);
|
||||
}
|
||||
|
||||
if (!comment) {
|
||||
comment = oldData.flagged.find(c => c.id === commentId);
|
||||
}
|
||||
|
||||
if (!comment) {
|
||||
comment = oldData.rejected.find(c => c.id === commentId);
|
||||
}
|
||||
|
||||
let accepted;
|
||||
let acceptedCount = oldData.acceptedCount;
|
||||
|
||||
@@ -97,7 +110,20 @@ export const setCommentStatus = graphql(SET_COMMENT_STATUS, {
|
||||
},
|
||||
updateQueries: {
|
||||
ModQueue: (oldData) => {
|
||||
const comment = oldData.all.find(c => c.id === commentId);
|
||||
let comment = oldData.all.find(c => c.id === commentId);
|
||||
|
||||
if (!comment) {
|
||||
comment = oldData.premod.find(c => c.id === commentId);
|
||||
}
|
||||
|
||||
if (!comment) {
|
||||
comment = oldData.flagged.find(c => c.id === commentId);
|
||||
}
|
||||
|
||||
if (!comment) {
|
||||
comment = oldData.accepted.find(c => c.id === commentId);
|
||||
}
|
||||
|
||||
let rejected;
|
||||
let rejectedCount = oldData.rejectedCount;
|
||||
|
||||
|
||||
@@ -71,12 +71,6 @@ export const loadMore = (fetchMore) => ({limit, cursor, sort, tab, asset_id}) =>
|
||||
]
|
||||
};
|
||||
|
||||
// if we're not in the all tab, put the new comments in there anyway
|
||||
// this way the acceptComment and rejectComment mutations don't break
|
||||
if (tab !== 'all') {
|
||||
updatedData.all = [...updatedData.all, ...comments];
|
||||
}
|
||||
|
||||
return updatedData;
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user