core: record_list: getHidden by uid

This commit is contained in:
undefined committed 2021-06-29 19:38:18 +08:00
1 parent a33708cd21
commit 791877098b
7 files changed
+9 -9

No files matched your search

+1 -1
View File
@@ -229,7 +229,7 @@ export class ContestEditHandler extends Handler {
const endAt = beginAtMoment.clone().add(duration, 'hours').toDate();
if (beginAtMoment.isSameOrAfter(endAt)) throw new ValidationError('duration');
const beginAt = beginAtMoment.toDate();
await problem.getList(domainId, pids, this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN), true);
await problem.getList(domainId, pids, this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN) || this.user._id, true);
if (tid) {
await contest.edit(domainId, tid, {
title, content, rule, beginAt, endAt, pids, rated,
+1 -1
View File
@@ -326,7 +326,7 @@ class HomeworkEditHandler extends Handler {
const endAt = penaltySince.clone().add(extensionDays, 'days');
if (beginAt.isSameOrAfter(penaltySince)) throw new ValidationError('endAtDate', 'endAtTime');
if (penaltySince.isAfter(endAt)) throw new ValidationError('extensionDays');
await problem.getList(domainId, pids, this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN), true);
await problem.getList(domainId, pids, this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN) || this.user._id, true);
if (!tid) {
tid = await contest.add(domainId, title, content, this.user._id,
'homework', beginAt.toDate(), endAt.toDate(), pids, rated,
+1 -1
View File
@@ -65,7 +65,7 @@ class RecordListHandler extends Handler {
canViewProblem
? problem.getList(domainId, rdocs.map(
(rdoc) => (rdoc.domainId === domainId ? rdoc.pid : `${rdoc.pdomain}:${rdoc.pid}`),
), canViewProblemHidden, false)
), canViewProblemHidden || this.user._id, false)
: Object.fromEntries([rdocs.map((rdoc) => [rdoc.pid, { ...problem.default, pid: rdoc.pid }])]),
]);
this.response.body = {
+1 -1
View File
@@ -104,7 +104,7 @@ class TrainingDetailHandler extends Handler {
const pids = training.getPids(tdoc.dag);
const [owner, pdict] = await Promise.all([
user.getById(domainId, tdoc.owner),
problem.getList(domainId, pids, this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN)),
problem.getList(domainId, pids, this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN) || this.user._id),
]);
const psdict = await problem.getListStatus(domainId, this.user._id, pids);
const donePids = new Set<number>();
+1 -1
View File
@@ -203,7 +203,7 @@ class UserDetailHandler extends Handler {
const pdict = this.user.hasPerm(PERM.PERM_VIEW_PROBLEM)
? await problem.getList(
domainId, rdocs.map((rdoc) => rdoc.pid),
this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN), false,
this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN) || this.user._id, false,
)
: Object.fromEntries(rdocs.map(
(rdoc) => [rdoc.pid, { ...problem.default, pid: rdoc.pid }],