| 91 | } |
| 92 | |
| 93 | async renderProblem(domainId, payload) { |
| 94 | const cur = payload.domainId ? await UserModel.getById(payload.domainId, this.user._id) : this.user; |
| 95 | let pdoc = cur.hasPerm(PERM.PERM_VIEW | PERM.PERM_VIEW_PROBLEM) |
| 96 | ? await ProblemModel.get(payload.domainId || domainId, payload.id) || ProblemModel.default |
| 97 | : ProblemModel.default; |
| 98 | if (pdoc.hidden && !cur.own(pdoc) && !cur.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN)) pdoc = ProblemModel.default; |
| 99 | return await this.renderHTML('partials/problem.html', { pdoc }); |
| 100 | } |
| 101 | |
| 102 | async renderContest(domainId, payload) { |
| 103 | const cur = payload.domainId ? await UserModel.getById(payload.domainId, this.user._id) : this.user; |