core: flush discussion node before re-init

This commit is contained in:
undefined committed 2021-10-10 19:49:57 +08:00
1 parent 18703533da
commit dc4464c19a
4 files changed
+9 -3

No files matched your search

+5
View File
@@ -243,6 +243,10 @@ export function getNode(domainId: string, _id: string) {
return document.get(domainId, document.TYPE_DISCUSSION_NODE, _id);
}
export function flushNodes(domainId: string) {
return document.deleteMulti(domainId, document.TYPE_DISCUSSION_NODE);
}
export async function getVnode(domainId: string, type: number, id: string, uid?: number) {
if (type === document.TYPE_PROBLEM) {
const pdoc = await problem.get(domainId, Number.isSafeInteger(+id) ? +id : id);
@@ -360,6 +364,7 @@ global.Hydro.model.discussion = {
setStatus,
addNode,
getNode,
flushNodes,
getNodes,
getVnode,
getListVnodes,