mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
core: fix type annotations
This commit is contained in:
1 parent
7f51df236a
commit
fdd353bcf1
1 file changed
+5
-5
@@ -17,7 +17,7 @@ import { PERM, STATUS } from './builtin';
|
||||
import * as document from './document';
|
||||
import problem from './problem';
|
||||
import RecordModel from './record';
|
||||
import user from './user';
|
||||
import user, { User } from './user';
|
||||
|
||||
interface AcmJournal {
|
||||
rid: ObjectID;
|
||||
@@ -707,24 +707,24 @@ export async function unlockScoreboard(domainId: string, tid: ObjectID) {
|
||||
await edit(domainId, tid, { unlocked: true });
|
||||
}
|
||||
|
||||
export function canViewHiddenScoreboard(this: Handler, tdoc: Tdoc<30>) {
|
||||
export function canViewHiddenScoreboard(this: { user: User }, tdoc: Tdoc<30>) {
|
||||
if (tdoc.rule === 'homework') return this.user.hasPerm(PERM.PERM_VIEW_HOMEWORK_HIDDEN_SCOREBOARD);
|
||||
return this.user.hasPerm(PERM.PERM_VIEW_CONTEST_HIDDEN_SCOREBOARD);
|
||||
}
|
||||
|
||||
export function canShowRecord(this: Handler, tdoc: Tdoc<30>, allowPermOverride = true) {
|
||||
export function canShowRecord(this: { user: User }, tdoc: Tdoc<30>, allowPermOverride = true) {
|
||||
if (RULES[tdoc.rule].showRecord(tdoc, new Date())) return true;
|
||||
if (allowPermOverride && canViewHiddenScoreboard.call(this, tdoc)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
export function canShowSelfRecord(this: Handler, tdoc: Tdoc<30>, allowPermOverride = true) {
|
||||
export function canShowSelfRecord(this: { user: User }, tdoc: Tdoc<30>, allowPermOverride = true) {
|
||||
if (RULES[tdoc.rule].showSelfRecord(tdoc, new Date())) return true;
|
||||
if (allowPermOverride && canViewHiddenScoreboard.call(this, tdoc)) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
export function canShowScoreboard(this: Handler, tdoc: Tdoc<30>, allowPermOverride = true) {
|
||||
export function canShowScoreboard(this: { user: User }, tdoc: Tdoc<30>, allowPermOverride = true) {
|
||||
if (RULES[tdoc.rule].showScoreboard(tdoc, new Date())) return true;
|
||||
if (allowPermOverride && canViewHiddenScoreboard.call(this, tdoc)) return true;
|
||||
return false;
|
||||
|
||||
Reference in new issue
Block a user