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:
parent
09e2efe8fd
commit
165e84d8e0
1 changed files with 40 additions and 8 deletions
|
@ -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
|
||||
};
|
||||
})
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue