diff --git a/packages/hydrooj/src/handler/record.ts b/packages/hydrooj/src/handler/record.ts index e23094270..2ec04c07a 100644 --- a/packages/hydrooj/src/handler/record.ts +++ b/packages/hydrooj/src/handler/record.ts @@ -94,14 +94,15 @@ export class RecordListHandler extends ContestDetailBaseHandler { let rdocs = invalid ? [] as RecordDoc[] : await cursor.skip((page - 1) * limit).limit(limit).toArray(); - const canViewProblem = tid || this.user.hasPerm(PERM.PERM_VIEW_PROBLEM); const canViewHiddenProblem = this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN) || this.user._id; const [udict, pdict] = full ? [{}, {}] : await Promise.all([ user.getList(domainId, rdocs.map((rdoc) => rdoc.uid)), - canViewProblem - ? problem.getList(domainId, rdocs.map((rdoc) => rdoc.pid), canViewHiddenProblem, false, problem.PROJECTION_LIST) - : Object.fromEntries(uniqBy(rdocs, 'pid').map((rdoc) => [rdoc.pid, { ...problem.default, pid: rdoc.pid }])), + tid + ? problem.getList(domainId, rdocs.map((rdoc) => rdoc.pid), true, false, problem.PROJECTION_CONTEST_LIST) + : this.user.hasPerm(PERM.PERM_VIEW_PROBLEM) + ? problem.getList(domainId, rdocs.map((rdoc) => rdoc.pid), canViewHiddenProblem, false, problem.PROJECTION_LIST) + : Object.fromEntries(uniqBy(rdocs, 'pid').map((rdoc) => [rdoc.pid, { ...problem.default, pid: rdoc.pid }])), ]); if (this.tdoc && !this.user.own(this.tdoc) && !this.user.hasPerm(PERM.PERM_EDIT_CONTEST)) { rdocs = rdocs.map((i) => contest.applyProjection(tdoc, i, this.user));