mirror of
https://github.com/wassname/talk.git
synced 2026-07-01 18:23:20 +08:00
Subtract ignored comments correctly
This commit is contained in:
@@ -21,16 +21,15 @@ export default {
|
||||
updateQueries: {
|
||||
CoralEmbedStream_Embed: (previous) => {
|
||||
const ignoredUserId = variables.id;
|
||||
const newNodes = previous.asset.featuredComments.nodes.filter((n) => n.user.id !== ignoredUserId);
|
||||
const removedCount = previous.asset.featuredComments.nodes.length - newNodes.length;
|
||||
const updated = update(previous, {
|
||||
asset: {
|
||||
featuredComments: {
|
||||
nodes: {
|
||||
$apply: (nodes) =>
|
||||
nodes.filter((n) => n.user.id !== ignoredUserId)
|
||||
}
|
||||
nodes: {$set: newNodes}
|
||||
},
|
||||
featuredCommentsCount: {
|
||||
$apply: (value) => value - 1
|
||||
$apply: (value) => value - removedCount,
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user