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:
parent
b908db41d1
commit
37db4df98a
1 changed files with 10 additions and 6 deletions
|
@ -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
|
||||
};
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue