mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-20 01:38:19 +08:00
core: 修正pid编辑
This commit is contained in:
1 parent
6e0aaf12a3
commit
84c1e9e0e4
2 files changed
+5
-2
No files matched your search
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "hydrooj",
|
"name": "hydrooj",
|
||||||
"version": "2.13.30",
|
"version": "2.13.31",
|
||||||
"bin": "bin/hydrooj.js",
|
"bin": "bin/hydrooj.js",
|
||||||
"main": "dist/loader.js",
|
"main": "dist/loader.js",
|
||||||
"typings": "dist/loader.d.ts",
|
"typings": "dist/loader.d.ts",
|
||||||
|
|||||||
@@ -418,7 +418,10 @@ export class ProblemEditHandler extends ProblemManageHandler {
|
|||||||
@param('content', Types.String, isContent)
|
@param('content', Types.String, isContent)
|
||||||
async post(domainId: string, title: string, content: string) {
|
async post(domainId: string, title: string, content: string) {
|
||||||
const $update: Partial<Pdoc> = { title, content };
|
const $update: Partial<Pdoc> = { title, content };
|
||||||
if (this.request.body.pid) $update.pid = checkPid(this.request.body.pid);
|
if (this.request.body.pid) {
|
||||||
|
if (this.request.body.pid.toString() === this.pdoc.docId.toString()) $update.pid = this.request.body.pid;
|
||||||
|
else $update.pid = checkPid(this.request.body.pid);
|
||||||
|
}
|
||||||
const pdoc = await problem.get(domainId, this.request.params.pid);
|
const pdoc = await problem.get(domainId, this.request.params.pid);
|
||||||
await problem.edit(domainId, pdoc.docId, $update);
|
await problem.edit(domainId, pdoc.docId, $update);
|
||||||
this.response.redirect = this.url('problem_detail', { pid: this.request.params.pid });
|
this.response.redirect = this.url('problem_detail', { pid: this.request.params.pid });
|
||||||
|
|||||||
Reference in new issue
Block a user