0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

Added handling for updating comment count based on local actions

refs https://github.com/TryGhost/Team/issues/1761
This commit is contained in:
Fabien "egg" O'Carroll 2022-08-08 17:36:43 +01:00 committed by Fabien 'egg' O'Carroll
parent b908db41d1
commit 37db4df98a

View file

@ -24,8 +24,8 @@ async function addComment({state, api, data: comment}) {
};
return {
comments: [commentStructured, ...state.comments]
// todo: fix pagination now?
comments: [commentStructured, ...state.comments],
commentCount: state.commentCount + 1
};
}
@ -52,7 +52,8 @@ async function addReply({state, api, data: {reply, parent}}) {
};
}
return c;
})
}),
commentCount: state.commentCount + 1
};
}
@ -84,7 +85,8 @@ async function hideComment({state, adminApi, data: comment}) {
...c,
replies
};
})
}),
commentCount: state.commentCount - 1
};
}
@ -116,7 +118,8 @@ async function showComment({state, adminApi, data: comment}) {
...c,
replies
};
})
}),
commentCount: state.commentCount + 1
};
}
@ -226,7 +229,8 @@ async function deleteComment({state, api, data: comment}) {
...c,
replies
};
})
}),
commentCount: state.commentCount - 1
};
}