mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
core: fix problem copy pid
This commit is contained in:
1 parent
0aba9f8215
commit
b10c67f5cf
4 files changed
+21
-6
No files matched your search
@@ -147,7 +147,7 @@ export class ProblemModel {
|
||||
static async copy(domainId: string, _id: number, target: string, pid?: string) {
|
||||
const original = await ProblemModel.get(domainId, _id);
|
||||
if (!original) throw new ProblemNotFoundError(domainId, _id);
|
||||
if (pid && await ProblemModel.get(target, pid)) pid = '';
|
||||
if (pid && (/^[0-9]+$/.test(pid) || await ProblemModel.get(target, pid))) pid = '';
|
||||
if (!pid && original.pid && !await ProblemModel.get(target, original.pid)) pid = original.pid;
|
||||
const docId = await ProblemModel.add(
|
||||
target, pid, original.title, original.content,
|
||||
|
||||
Reference in new issue
Block a user