core: fix problem copy pid

This commit is contained in:
undefined committed 2021-10-25 16:48:50 +08:00
1 parent 0aba9f8215
commit b10c67f5cf
4 files changed
+21 -6

No files matched your search

+2 -3
View File
@@ -292,13 +292,12 @@ export class ProblemDetailHandler extends ProblemHandler {
}
@param('target', Types.String)
@param('pid', Types.String, true)
async postCopy(domainId: string, target: string, pid: string) {
async postCopy(domainId: string, target: string) {
const ddoc = await domain.get(target);
if (!ddoc) throw new NotFoundError(target);
const dudoc = await user.getById(target, this.user._id);
if (!dudoc.hasPerm(PERM.PERM_CREATE_PROBLEM)) throw new PermissionError(PERM.PERM_CREATE_PROBLEM);
const docId = await problem.copy(domainId, this.user.docId, target, pid);
const docId = await problem.copy(domainId, this.user.docId, target, this.pdoc.pid);
this.response.redirect = this.url('problem_detail', { domainId: target, pid: docId });
}