core&ui: fix record display (#693)

This commit is contained in:
panda authored and GitHub committed 2023-12-01 06:52:10 +08:00
1 parent 323f6b72f1
commit e0db6c6d47
4 files changed
+12 -2

No files matched your search

+6
View File
@@ -280,6 +280,12 @@ export class ContestProblemListHandler extends ContestDetailBaseHandler {
await record.getMulti(domainId, { contest: tid, uid: this.user._id })
.sort({ _id: -1 }).toArray(),
]);
if (!this.user.own(this.tdoc) && !this.user.hasPerm(PERM.PERM_EDIT_CONTEST)) {
this.response.body.rdocs = this.response.body.rdocs.map((rdoc) => contest.applyProjection(this.tdoc, rdoc, this.user));
for (const psdoc of psdocs) {
this.response.body.rdict[psdoc.rid] = contest.applyProjection(this.tdoc, this.response.body.rdict[psdoc.rid], this.user);
}
}
this.response.body.canViewRecord = true;
} else {
for (const i of psdocs) this.response.body.rdict[i.rid] = { _id: i.rid };