mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: fix: ProblemAlreadyExistError should be thrown with the new PID, not the old one (#1052)
This commit is contained in:
1 parent
dfc94fdfb4
commit
99e05f878f
1 file changed
+1
-1
@@ -616,7 +616,7 @@ export class ProblemEditHandler extends ProblemManageHandler {
|
|||||||
newPid: string | number = '', hidden = false, tag: string[] = [], difficulty = 0,
|
newPid: string | number = '', hidden = false, tag: string[] = [], difficulty = 0,
|
||||||
) {
|
) {
|
||||||
if (typeof newPid !== 'string') newPid = `P${newPid}`;
|
if (typeof newPid !== 'string') newPid = `P${newPid}`;
|
||||||
if (newPid !== this.pdoc.pid && await problem.get(domainId, newPid)) throw new ProblemAlreadyExistError(pid);
|
if (newPid !== this.pdoc.pid && await problem.get(domainId, newPid)) throw new ProblemAlreadyExistError(newPid);
|
||||||
const $update: Partial<ProblemDoc> = {
|
const $update: Partial<ProblemDoc> = {
|
||||||
title, content, pid: newPid, hidden, tag: tag ?? [], difficulty, html: false,
|
title, content, pid: newPid, hidden, tag: tag ?? [], difficulty, html: false,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in new issue
Block a user