ui: rich_media: check hidden problem

This commit is contained in:
undefined committed 2021-06-29 18:57:01 +08:00
1 parent 2638606dae
commit 900cce3614
4 files changed
+4 -4

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "hydrooj", "name": "hydrooj",
"version": "2.29.1", "version": "2.29.2",
"bin": "bin/hydrooj.js", "bin": "bin/hydrooj.js",
"main": "dist/loader.js", "main": "dist/loader.js",
"typings": "dist/loader.d.ts", "typings": "dist/loader.d.ts",
+1 -1
View File
@@ -228,7 +228,7 @@ class RecordMainConnectionHandler extends ConnectionHandler {
problem.get(this.domainId, rdoc.pid, null), problem.get(this.domainId, rdoc.pid, null),
]); ]);
if (pdoc) { if (pdoc) {
if (pdoc.hidden && !this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN)) pdoc = null; if (pdoc.hidden && !this.user.own(pdoc) && !this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN)) pdoc = null;
if (!this.user.hasPerm(PERM.PERM_VIEW_PROBLEM)) pdoc = null; if (!this.user.hasPerm(PERM.PERM_VIEW_PROBLEM)) pdoc = null;
} }
if (this.pretest) this.send({ rdoc }); if (this.pretest) this.send({ rdoc });
+1 -1
View File
@@ -134,7 +134,7 @@ class RichMediaHandler extends Handler {
let pdoc = cur.hasPerm(PERM.PERM_VIEW | PERM.PERM_VIEW_PROBLEM) let pdoc = cur.hasPerm(PERM.PERM_VIEW | PERM.PERM_VIEW_PROBLEM)
? await problem.get(domainId, payload.id) || problem.default ? await problem.get(domainId, payload.id) || problem.default
: problem.default; : problem.default;
if (pdoc.hidden && !cur.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN)) pdoc = problem.default; if (pdoc.hidden && !cur.own(pdoc) && !cur.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN)) pdoc = problem.default;
return await this.renderHTML('partials/problem.html', { pdoc }); return await this.renderHTML('partials/problem.html', { pdoc });
} }
+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "@hydrooj/ui-default", "name": "@hydrooj/ui-default",
"version": "4.12.0", "version": "4.12.1",
"author": "undefined <i@undefined.moe>", "author": "undefined <i@undefined.moe>",
"license": "AGPL-3.0", "license": "AGPL-3.0",
"main": "hydro.js", "main": "hydro.js",