mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-19 17:38:19 +08:00
core: discussion_raw: add existance check
This commit is contained in:
1 file changed
+6
-1
@@ -363,7 +363,12 @@ class DiscussionRawHandler extends DiscussionHandler {
|
|||||||
this.response.body.history = await discussion.getHistory(domainId, drrid || drid || did);
|
this.response.body.history = await discussion.getHistory(domainId, drrid || drid || did);
|
||||||
} else {
|
} else {
|
||||||
const [doc] = await discussion.getHistory(domainId, drrid || drid || did, ts ? { time: new Date(ts) } : {});
|
const [doc] = await discussion.getHistory(domainId, drrid || drid || did, ts ? { time: new Date(ts) } : {});
|
||||||
if (!doc && ts) throw new DiscussionNotFoundError(drrid || drid || did);
|
if (!doc) {
|
||||||
|
if (ts) throw new DiscussionNotFoundError(drrid || drid || did);
|
||||||
|
if (drrid && !this.drrdoc) throw new DiscussionNotFoundError(drrid);
|
||||||
|
if (drid && !this.drdoc) throw new DiscussionNotFoundError(drid);
|
||||||
|
if (did && !this.ddoc) throw new DiscussionNotFoundError(did);
|
||||||
|
}
|
||||||
this.response.type = 'text/markdown';
|
this.response.type = 'text/markdown';
|
||||||
this.response.body = doc ? doc.content : drrid ? this.drrdoc.content : drid ? this.drdoc.content : this.ddoc.content;
|
this.response.body = doc ? doc.content : drrid ? this.drrdoc.content : drid ? this.drdoc.content : this.ddoc.content;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in new issue
Block a user