0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Fixed delete/show on replies

This commit is contained in:
Kevin Ansfield 2022-07-07 14:29:24 +02:00
parent 09e2efe8fd
commit 165e84d8e0

View file

@ -77,13 +77,29 @@ async function showComment({state, adminApi, data: comment}) {
return {
comments: state.comments.map((c) => {
if (c.id === comment.id) {
const replies = c.replies.map((r) => {
if (r.id === comment.id) {
return {
...c,
...r,
status: 'published'
};
}
return c;
return r;
});
if (c.id === comment.id) {
return {
...c,
status: 'published',
replies
};
}
return {
...c,
replies
};
})
};
}
@ -132,13 +148,29 @@ async function deleteComment({state, api, data: comment}) {
return {
comments: state.comments.map((c) => {
if (c.id === comment.id) {
const replies = c.replies.map((r) => {
if (r.id === comment.id) {
return {
...c,
...r,
status: 'deleted'
};
}
return c;
return r;
});
if (c.id === comment.id) {
return {
...c,
status: 'deleted',
replies
};
}
return {
...c,
replies
};
})
};
}