mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
core: fix when tsdoc doesn't exist
This commit is contained in:
1 parent
c5f9f86dd7
commit
b8c67114e1
3 files changed
+6
-3
No files matched your search
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "hydrooj",
|
||||
"version": "2.29.19",
|
||||
"version": "2.29.20",
|
||||
"bin": "bin/hydrooj.js",
|
||||
"main": "dist/loader.js",
|
||||
"typings": "dist/loader.d.ts",
|
||||
|
||||
@@ -91,7 +91,10 @@ export class ProblemMainHandler extends ProblemHandler {
|
||||
if (sort) pdocs = pdocs.sort((a, b) => sort.indexOf(a.docId) - sort.indexOf(b.docId));
|
||||
if (q) {
|
||||
const pdoc = await problem.get(domainId, +q || q, problem.PROJECTION_LIST);
|
||||
if (pdoc) pdocs.filter((doc) => doc.docId !== pdoc.docId).unshift(pdoc);
|
||||
if (pdoc) {
|
||||
pdocs = pdocs.filter((doc) => doc.docId !== pdoc.docId);
|
||||
pdocs.unshift(pdoc);
|
||||
}
|
||||
}
|
||||
if (this.user.hasPriv(PRIV.PRIV_USER_PROFILE)) {
|
||||
psdict = await problem.getListStatus(
|
||||
|
||||
@@ -245,7 +245,7 @@ export async function getVnode(domainId: string, type: number, id: string, uid?:
|
||||
if (!tdoc) throw new DiscussionNodeNotFoundError(id);
|
||||
if (uid) {
|
||||
const tsdoc = await model.getStatus(domainId, _id, uid);
|
||||
tdoc.attend = tsdoc.attend || tsdoc.enroll;
|
||||
tdoc.attend = tsdoc?.attend || tsdoc?.enroll;
|
||||
}
|
||||
return { ...tdoc, type, id };
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user