mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 17:36:08 +08:00
core: fix contest discussion parentId (#662)
This commit is contained in:
1 parent
385d90fa39
commit
a9b2f68d2d
2 files changed
+15
-1
No files matched your search
@@ -288,7 +288,7 @@ export async function getVnode(domainId: string, type: number, id: string, uid?:
|
||||
tdoc.attend = tsdoc?.attend || tsdoc?.enroll;
|
||||
}
|
||||
return {
|
||||
...tdoc, type, id, hidden: false,
|
||||
...tdoc, type, id: _id, hidden: false,
|
||||
};
|
||||
}
|
||||
return {
|
||||
|
||||
@@ -616,6 +616,20 @@ const scripts: UpgradeScript[] = [
|
||||
}
|
||||
return true;
|
||||
},
|
||||
async function _84_85() {
|
||||
return await iterateAllDomain(async ({ _id }) => {
|
||||
const cursor = discussion.getMulti(_id, { parentType: document.TYPE_CONTEST });
|
||||
for await (const ddoc of cursor) {
|
||||
const parentId = new ObjectId(ddoc.parentId);
|
||||
await discussion.edit(_id, ddoc.docId, { parentId });
|
||||
try {
|
||||
await contest.get(_id, parentId);
|
||||
} catch (e) {
|
||||
await discussion.del(_id, ddoc.docId);
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
];
|
||||
|
||||
export default scripts;
|
||||
Reference in new issue
Block a user