mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
core: bug fix
This commit is contained in:
4 files changed
+11
-8
No files matched your search
@@ -368,11 +368,13 @@ function set(s: Setting, key: string, value: any) {
|
||||
if (Number.isNaN(+value)) throw new ValidationError(key);
|
||||
return +value;
|
||||
}
|
||||
if (['json', 'yaml', 'markdown', 'textarea'].includes(s.type)) {
|
||||
if (!Types.Content[1](value)) throw new ValidationError(key);
|
||||
}
|
||||
if (s.type === 'text') {
|
||||
if (!Types.ShortString[1](value)) throw new ValidationError(key);
|
||||
if (value) {
|
||||
if (['json', 'yaml', 'markdown', 'textarea'].includes(s.type)) {
|
||||
if (!Types.Content[1](value)) throw new ValidationError(key);
|
||||
}
|
||||
if (s.type === 'text') {
|
||||
if (!Types.ShortString[1](value)) throw new ValidationError(key);
|
||||
}
|
||||
}
|
||||
if (s.subType === 'yaml') {
|
||||
try {
|
||||
|
||||
@@ -128,7 +128,7 @@ class HomeworkDetailHandler extends Handler {
|
||||
Object.assign(this.response.body, { pdict, psdict, rdict });
|
||||
}
|
||||
|
||||
async postAttend(domainId: string) {
|
||||
async postAttend({ domainId }) {
|
||||
this.checkPerm(PERM.PERM_ATTEND_HOMEWORK);
|
||||
if (contest.isDone(this.tdoc)) throw new HomeworkNotLiveError(this.tdoc.docId);
|
||||
await contest.attend(domainId, this.tdoc.docId, this.user._id);
|
||||
|
||||
Reference in new issue
Block a user