mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: fix scoreboard_export PERM_VIEW_DISPLAYNAME (#793)
This commit is contained in:
1 parent
a2ed84a4be
commit
87adfd288c
5 files changed
+16
-12
No files matched your search
@@ -314,7 +314,7 @@ export class ContestScoreboardHandler extends ContestDetailBaseHandler {
|
||||
await this.exportScoreboard(domainId, tid, ext);
|
||||
return;
|
||||
}
|
||||
const config: ScoreboardConfig = { isExport: false };
|
||||
const config: ScoreboardConfig = { isExport: false, showDisplayName: this.user.hasPerm(PERM.PERM_VIEW_DISPLAYNAME) };
|
||||
if (!realtime && this.tdoc.lockAt && !this.tdoc.unlocked) {
|
||||
config.lockAt = this.tdoc.lockAt;
|
||||
}
|
||||
@@ -388,7 +388,9 @@ export class ContestScoreboardHandler extends ContestDetailBaseHandler {
|
||||
csv: async (rows) => `\uFEFF${rows.map((c) => (c.map((i) => i.value?.toString().replace(/\n/g, ' ')).join(','))).join('\n')}`,
|
||||
html: (rows, tdoc) => this.renderHTML('contest_scoreboard_download_html.html', { rows, tdoc }),
|
||||
};
|
||||
const [, rows] = await contest.getScoreboard.call(this, domainId, tid, { isExport: true, lockAt: this.tdoc.lockAt });
|
||||
const [, rows] = await contest.getScoreboard.call(this, domainId, tid, {
|
||||
isExport: true, lockAt: this.tdoc.lockAt, showDisplayName: this.user.hasPerm(PERM.PERM_VIEW_DISPLAYNAME),
|
||||
});
|
||||
this.binary(await getContent[ext](rows, this.tdoc), `${this.tdoc.title}.${ext}`);
|
||||
}
|
||||
|
||||
@@ -588,7 +590,7 @@ export class ContestManagementHandler extends ContestManagementBaseHandler {
|
||||
owner_udoc: await user.getById(domainId, this.tdoc.owner),
|
||||
pdict: await problem.getList(domainId, this.tdoc.pids, true, true, [...problem.PROJECTION_CONTEST_LIST, 'tag']),
|
||||
files: sortFiles(this.tdoc.files || []),
|
||||
udict: await user.getListForRender(domainId, tcdocs.map((i) => i.owner)),
|
||||
udict: await user.getListForRender(domainId, tcdocs.map((i) => i.owner), this.user.hasPerm(PERM.PERM_VIEW_DISPLAYNAME)),
|
||||
tcdocs,
|
||||
urlForFile: (filename: string) => this.url('contest_file_download', { tid, filename }),
|
||||
};
|
||||
@@ -693,7 +695,8 @@ export class ContestUserHandler extends ContestManagementBaseHandler {
|
||||
for (const tsdoc of tsdocs) {
|
||||
tsdoc.endAt = (this.tdoc.duration && tsdoc.startAt) ? moment(tsdoc.startAt).add(this.tdoc.duration, 'hours').toDate() : null;
|
||||
}
|
||||
const udict = await user.getListForRender(domainId, [this.tdoc.owner, ...tsdocs.map((i) => i.uid)]);
|
||||
const udict = await user.getListForRender(domainId,
|
||||
[this.tdoc.owner, ...tsdocs.map((i) => i.uid)], this.user.hasPerm(PERM.PERM_VIEW_DISPLAYNAME));
|
||||
this.response.body = { tdoc: this.tdoc, tsdocs, udict };
|
||||
this.response.pjax = 'partials/contest_user.html';
|
||||
this.response.template = 'contest_user.html';
|
||||
@@ -733,7 +736,7 @@ export class ContestBalloonHandler extends ContestManagementBaseHandler {
|
||||
owner_udoc: await user.getById(domainId, this.tdoc.owner),
|
||||
pdict: await problem.getList(domainId, this.tdoc.pids, true, true, problem.PROJECTION_CONTEST_LIST),
|
||||
bdocs,
|
||||
udict: await user.getListForRender(domainId, uids),
|
||||
udict: await user.getListForRender(domainId, uids, this.user.hasPerm(PERM.PERM_VIEW_DISPLAYNAME)),
|
||||
};
|
||||
this.response.pjax = 'partials/contest_balloon.html';
|
||||
this.response.template = 'contest_balloon.html';
|
||||
|
||||
@@ -112,7 +112,7 @@ class TrainingDetailHandler extends Handler {
|
||||
const canViewHidden = this.user.hasPerm(PERM.PERM_VIEW_PROBLEM_HIDDEN) || this.user._id;
|
||||
const [udoc, udict, pdict, psdict, selfPsdict] = await Promise.all([
|
||||
user.getById(domainId, tdoc.owner),
|
||||
user.getListForRender(domainId, enrollUsers),
|
||||
user.getListForRender(domainId, enrollUsers, this.user.hasPerm(PERM.PERM_VIEW_DISPLAYNAME)),
|
||||
problem.getList(domainId, pids, canViewHidden, true),
|
||||
problem.getListStatus(domainId, uid, pids),
|
||||
shouldCompare ? problem.getListStatus(domainId, this.user._id, pids) : {},
|
||||
|
||||
Reference in new issue
Block a user