mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
allow join by unrank user without code
This commit is contained in:
1 parent
9470dd9cfa
commit
cd8efa2025
3 files changed
+16
-18
No files matched your search
@@ -224,8 +224,10 @@ 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) throw new InvalidTokenError('Contest Invitation', code);
|
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);
|
await contest.attend(domainId, tid, this.user._id);
|
||||||
|
if (this.tdoc.unrankUser.includes(this.user._id)
|
||||||
|
|| (this.tdoc._code && code !== this.tdoc._code && this.tdoc.uninvite)) contest.setStatus(domainId, tid, this.user._id, { unrank: true });
|
||||||
this.back();
|
this.back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -412,11 +414,14 @@ export class ContestEditHandler extends Handler {
|
|||||||
@param('assign', Types.CommaSeperatedArray, true)
|
@param('assign', Types.CommaSeperatedArray, true)
|
||||||
@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('uninvite', 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,
|
contestDuration: number = null, maintainer: number[] = null, uninvite = false, 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);
|
||||||
@@ -457,7 +462,7 @@ export class ContestEditHandler extends Handler {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
await contest.edit(domainId, tid, {
|
await contest.edit(domainId, tid, {
|
||||||
assign, _code, autoHide, lockAt,
|
assign, _code, autoHide, lockAt, maintainer, uninvite, 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 });
|
||||||
|
|||||||
@@ -35,6 +35,11 @@
|
|||||||
<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 %}
|
||||||
|
<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>
|
||||||
|
</blockquote>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -73,7 +73,7 @@
|
|||||||
}) }}
|
}) }}
|
||||||
{{ form.form_textarea({
|
{{ form.form_textarea({
|
||||||
columns:null,
|
columns:null,
|
||||||
label:'Content',
|
label:'Description',
|
||||||
name:'content',
|
name:'content',
|
||||||
value:tdoc['content']|default(''),
|
value:tdoc['content']|default(''),
|
||||||
markdown:true
|
markdown:true
|
||||||
@@ -117,7 +117,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div style="display: none" class="authorize-settings authorize--invite">
|
<div style="display: none" class="authorize-settings authorize--invite">
|
||||||
{{ form.form_text({
|
{{ form.form_text({
|
||||||
columns:9,
|
columns:6,
|
||||||
label:'Invitation Code',
|
label:'Invitation Code',
|
||||||
name:'code',
|
name:'code',
|
||||||
placeholder:_('(leave blank if none)'),
|
placeholder:_('(leave blank if none)'),
|
||||||
@@ -125,19 +125,7 @@
|
|||||||
disabled:true,
|
disabled:true,
|
||||||
row:false
|
row:false
|
||||||
}) }}
|
}) }}
|
||||||
</div>
|
{{ form.form_checkbox({
|
||||||
</div>
|
|
||||||
<div class="row">
|
|
||||||
{{ form.form_text({
|
|
||||||
columns:9,
|
|
||||||
label:'UnRank User',
|
|
||||||
name:'unrankUser',
|
|
||||||
help_text:_('User who will not show rank in scoreboard'),
|
|
||||||
value:tdoc.unrankUser|default(''),
|
|
||||||
row:false
|
|
||||||
}) }}
|
|
||||||
<div style="display: none" class="authorize-settings authorize--invite">
|
|
||||||
{{ form.form_checkbox({
|
|
||||||
columns:3,
|
columns:3,
|
||||||
label:'Allow join by unrank',
|
label:'Allow join by unrank',
|
||||||
name:'uninvite',
|
name:'uninvite',
|
||||||
|
|||||||
Reference in new issue
Block a user