From ae4800b779c345a97ab350b5cb1b213d72e787af Mon Sep 17 00:00:00 2001
From: undefined
Date: Fri, 23 Dec 2022 00:16:34 +0800
Subject: [PATCH] ui: remove incomplete uninvite key
---
packages/hydrooj/src/handler/contest.ts | 13 ++++---------
packages/hydrooj/src/interface.ts | 1 -
packages/ui-default/templates/contest_detail.html | 2 +-
packages/ui-default/templates/contest_edit.html | 10 +---------
4 files changed, 6 insertions(+), 20 deletions(-)
diff --git a/packages/hydrooj/src/handler/contest.ts b/packages/hydrooj/src/handler/contest.ts
index d1e35627..3d8e1277 100644
--- a/packages/hydrooj/src/handler/contest.ts
+++ b/packages/hydrooj/src/handler/contest.ts
@@ -218,12 +218,8 @@ export class ContestDetailHandler extends Handler {
@param('code', Types.String, true)
async postAttend(domainId: string, tid: ObjectID, code = '') {
if (contest.isDone(this.tdoc)) throw new ContestNotLiveError(tid);
- if (this.tdoc._code && code !== this.tdoc._code && !this.tdoc.uninvite) throw new InvalidTokenError('Contest Invitation', code);
- await contest.attend(
- domainId, tid, this.user._id,
- (this.tdoc._code && code !== this.tdoc._code && this.tdoc.uninvite)
- ? { unrank: true } : {},
- );
+ if (this.tdoc._code && code !== this.tdoc._code) throw new InvalidTokenError('Contest Invitation', code);
+ await contest.attend(domainId, tid, this.user._id);
this.back();
}
}
@@ -411,13 +407,12 @@ export class ContestEditHandler extends Handler {
@param('lock', Types.UnsignedInt, true)
@param('contestDuration', Types.Float, true)
@param('maintainer', Types.NumericArray, true)
- @param('uninvite', Types.Boolean, true)
@param('allowViewCode', Types.Boolean, true)
async postUpdate(
domainId: string, tid: ObjectID, beginAtDate: string, beginAtTime: string, duration: number,
title: string, content: string, rule: string, _pids: string, rated = false,
_code = '', autoHide = false, assign: string[] = null, lock: number = null,
- contestDuration: number = null, maintainer: number[] = null, uninvite = false, allowViewCode = true,
+ contestDuration: number = null, maintainer: number[] = null, allowViewCode = true,
) {
if (autoHide) this.checkPerm(PERM.PERM_EDIT_PROBLEM);
const pids = _pids.replace(/,/g, ',').split(',').map((i) => +i).filter((i) => i);
@@ -458,7 +453,7 @@ export class ContestEditHandler extends Handler {
});
}
await contest.edit(domainId, tid, {
- assign, _code, autoHide, lockAt, maintainer, uninvite, allowViewCode,
+ assign, _code, autoHide, lockAt, maintainer, allowViewCode,
});
this.response.body = { tid };
this.response.redirect = this.url('contest_detail', { tid });
diff --git a/packages/hydrooj/src/interface.ts b/packages/hydrooj/src/interface.ts
index e9d9c6ca..d32cb57e 100644
--- a/packages/hydrooj/src/interface.ts
+++ b/packages/hydrooj/src/interface.ts
@@ -367,7 +367,6 @@ export interface Tdoc
diff --git a/packages/ui-default/templates/contest_edit.html b/packages/ui-default/templates/contest_edit.html index b07fb1cc..16c9b969 100644 --- a/packages/ui-default/templates/contest_edit.html +++ b/packages/ui-default/templates/contest_edit.html @@ -117,21 +117,13 @@{{ _('The contest is a invitational contest. However it allow users attend contest without the invitation code. Those users will not be ranked.') }}