core: also hide hidden problem when search

This commit is contained in:
undefined committed 2021-12-01 17:51:30 +08:00
1 parent 1c26f25654
commit 71a5f6dd13
2 files changed
+7 -1

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "hydrooj",
"version": "3.1.46",
"version": "3.1.47",
"bin": "bin/hydrooj.js",
"main": "src/loader",
"module": "src/loader",
+6
View File
@@ -161,6 +161,12 @@ export class ProblemMainHandler extends ProblemHandler {
pdocs.unshift(pdoc);
pcount = pcount - count + pdocs.length;
}
const canViewHidden = this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN);
if (!canViewHidden) {
const unshift = [];
for (const doc of pdocs) if (doc.hidden && !this.user.own(doc)) unshift.push(doc);
for (const task of unshift) pdocs.unshift(task);
}
}
if (this.user.hasPriv(PRIV.PRIV_USER_PROFILE)) {
psdict = await problem.getListStatus(