mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 09:46:28 +08:00
core: add pdoc into to record_detail render
This commit is contained in:
1 parent
50dc6f25b3
commit
ba4c5b03d2
1 file changed
+5
-3
@@ -8,7 +8,7 @@ import {
|
|||||||
import { RecordDoc, Tdoc } from '../interface';
|
import { RecordDoc, Tdoc } from '../interface';
|
||||||
import { PERM, PRIV, STATUS } from '../model/builtin';
|
import { PERM, PRIV, STATUS } from '../model/builtin';
|
||||||
import * as contest from '../model/contest';
|
import * as contest from '../model/contest';
|
||||||
import problem from '../model/problem';
|
import problem, { ProblemDoc } from '../model/problem';
|
||||||
import record from '../model/record';
|
import record from '../model/record';
|
||||||
import { langs } from '../model/setting';
|
import { langs } from '../model/setting';
|
||||||
import storage from '../model/storage';
|
import storage from '../model/storage';
|
||||||
@@ -318,6 +318,7 @@ class RecordMainConnectionHandler extends ConnectionHandler {
|
|||||||
|
|
||||||
class RecordDetailConnectionHandler extends ConnectionHandler {
|
class RecordDetailConnectionHandler extends ConnectionHandler {
|
||||||
cleanup: bus.Disposable = () => { };
|
cleanup: bus.Disposable = () => { };
|
||||||
|
pdoc: ProblemDoc;
|
||||||
rid: string = '';
|
rid: string = '';
|
||||||
disconnectTimeout: NodeJS.Timeout;
|
disconnectTimeout: NodeJS.Timeout;
|
||||||
throttleSend: any;
|
throttleSend: any;
|
||||||
@@ -351,6 +352,7 @@ class RecordDetailConnectionHandler extends ConnectionHandler {
|
|||||||
if (!problem.canViewBy(pdoc, this.user)) throw new PermissionError(PERM.PERM_VIEW_PROBLEM_HIDDEN);
|
if (!problem.canViewBy(pdoc, this.user)) throw new PermissionError(PERM.PERM_VIEW_PROBLEM_HIDDEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
this.pdoc = pdoc;
|
||||||
this.throttleSend = throttle(this.sendUpdate, 1000, { trailing: true });
|
this.throttleSend = throttle(this.sendUpdate, 1000, { trailing: true });
|
||||||
this.rid = rid.toString();
|
this.rid = rid.toString();
|
||||||
this.cleanup = bus.on('record/change', this.onRecordChange.bind(this));
|
this.cleanup = bus.on('record/change', this.onRecordChange.bind(this));
|
||||||
@@ -359,8 +361,8 @@ class RecordDetailConnectionHandler extends ConnectionHandler {
|
|||||||
|
|
||||||
async sendUpdate(rdoc: RecordDoc) {
|
async sendUpdate(rdoc: RecordDoc) {
|
||||||
this.send({
|
this.send({
|
||||||
status_html: await this.renderHTML('record_detail_status.html', { rdoc }),
|
status_html: await this.renderHTML('record_detail_status.html', { rdoc, pdoc: this.pdoc }),
|
||||||
summary_html: await this.renderHTML('record_detail_summary.html', { rdoc }),
|
summary_html: await this.renderHTML('record_detail_summary.html', { rdoc, pdoc: this.pdoc }),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in new issue
Block a user