mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
ui: remove incomplete uninvite key
This commit is contained in:
1 parent
be30945487
commit
ae4800b779
4 files changed
+6
-20
No files matched your search
@@ -218,12 +218,8 @@ export class ContestDetailHandler extends Handler {
|
|||||||
@param('code', Types.String, true)
|
@param('code', Types.String, true)
|
||||||
async postAttend(domainId: string, tid: ObjectID, code = '') {
|
async postAttend(domainId: string, tid: ObjectID, code = '') {
|
||||||
if (contest.isDone(this.tdoc)) throw new ContestNotLiveError(tid);
|
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);
|
if (this.tdoc._code && code !== this.tdoc._code) throw new InvalidTokenError('Contest Invitation', code);
|
||||||
await contest.attend(
|
await contest.attend(domainId, tid, this.user._id);
|
||||||
domainId, tid, this.user._id,
|
|
||||||
(this.tdoc._code && code !== this.tdoc._code && this.tdoc.uninvite)
|
|
||||||
? { unrank: true } : {},
|
|
||||||
);
|
|
||||||
this.back();
|
this.back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -411,13 +407,12 @@ export class ContestEditHandler extends Handler {
|
|||||||
@param('lock', Types.UnsignedInt, true)
|
@param('lock', Types.UnsignedInt, true)
|
||||||
@param('contestDuration', Types.Float, true)
|
@param('contestDuration', Types.Float, true)
|
||||||
@param('maintainer', Types.NumericArray, true)
|
@param('maintainer', Types.NumericArray, true)
|
||||||
@param('uninvite', Types.Boolean, true)
|
|
||||||
@param('allowViewCode', Types.Boolean, true)
|
@param('allowViewCode', Types.Boolean, true)
|
||||||
async postUpdate(
|
async postUpdate(
|
||||||
domainId: string, tid: ObjectID, beginAtDate: string, beginAtTime: string, duration: number,
|
domainId: string, tid: ObjectID, beginAtDate: string, beginAtTime: string, duration: number,
|
||||||
title: string, content: string, rule: string, _pids: string, rated = false,
|
title: string, content: string, rule: string, _pids: string, rated = false,
|
||||||
_code = '', autoHide = false, assign: string[] = null, lock: number = null,
|
_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);
|
if (autoHide) this.checkPerm(PERM.PERM_EDIT_PROBLEM);
|
||||||
const pids = _pids.replace(/,/g, ',').split(',').map((i) => +i).filter((i) => i);
|
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, {
|
await contest.edit(domainId, tid, {
|
||||||
assign, _code, autoHide, lockAt, maintainer, uninvite, allowViewCode,
|
assign, _code, autoHide, lockAt, maintainer, allowViewCode,
|
||||||
});
|
});
|
||||||
this.response.body = { tid };
|
this.response.body = { tid };
|
||||||
this.response.redirect = this.url('contest_detail', { tid });
|
this.response.redirect = this.url('contest_detail', { tid });
|
||||||
|
|||||||
@@ -367,7 +367,6 @@ export interface Tdoc<docType = document['TYPE_CONTEST'] | document['TYPE_TRAINI
|
|||||||
lockAt?: Date;
|
lockAt?: Date;
|
||||||
unlocked?: boolean;
|
unlocked?: boolean;
|
||||||
autoHide?: boolean;
|
autoHide?: boolean;
|
||||||
uninvite?: boolean;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* In hours
|
* In hours
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
<p>{{ _('The contest is a flexible time contest. You need to complete the contest within a specified time after you attended.') }}</p>
|
<p>{{ _('The contest is a flexible time contest. You need to complete the contest within a specified time after you attended.') }}</p>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if tdoc.code and tdoc.uninvite %}
|
{% if tdoc.code %}
|
||||||
<blockquote class="note">
|
<blockquote class="note">
|
||||||
<p>{{ _('The contest is a invitational contest. However it allow users attend contest without the invitation code. Those users will not be ranked.') }}</p>
|
<p>{{ _('The contest is a invitational contest. However it allow users attend contest without the invitation code. Those users will not be ranked.') }}</p>
|
||||||
</blockquote>
|
</blockquote>
|
||||||
|
|||||||
@@ -117,21 +117,13 @@
|
|||||||
</div>
|
</div>
|
||||||
<div style="display: none" data-perm="invite">
|
<div style="display: none" data-perm="invite">
|
||||||
{{ form.form_text({
|
{{ form.form_text({
|
||||||
columns:6,
|
columns:9,
|
||||||
label:'Invitation Code',
|
label:'Invitation Code',
|
||||||
name:'code',
|
name:'code',
|
||||||
placeholder:_('(leave blank if none)'),
|
placeholder:_('(leave blank if none)'),
|
||||||
value:tdoc._code|default(''),
|
value:tdoc._code|default(''),
|
||||||
disabled:true,
|
disabled:true,
|
||||||
row:false
|
row:false
|
||||||
}) }}
|
|
||||||
{{ form.form_checkbox({
|
|
||||||
columns:3,
|
|
||||||
label:'Allow unranked attendance',
|
|
||||||
name:'uninvite',
|
|
||||||
placeholder:_("Allow user who doesn't have a invitation code join unranked"),
|
|
||||||
value:tdoc.uninvite|default(true),
|
|
||||||
row:false
|
|
||||||
}) }}
|
}) }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in new issue
Block a user