mirror of
https://gitcode.com/gh_mirrors/hy/Hydro.git
synced 2026-10-17 09:36:08 +08:00
core: fix discussion history
This commit is contained in:
3 files changed
+7
-8
No files matched your search
@@ -368,15 +368,8 @@ class DiscussionRawHandler extends DiscussionHandler {
|
||||
|
||||
class DiscussionEditHandler extends DiscussionHandler {
|
||||
async get() {
|
||||
const path = [
|
||||
['Hydro', 'homepage'],
|
||||
['discussion_main', 'discussion_main'],
|
||||
[this.vnode.title, 'discussion_node', { type: discussion.typeDisplay[this.ddoc.parentType], name: this.ddoc.parentId }, true],
|
||||
[this.ddoc.title, 'discussion_detail', { did: this.ddoc.docId }, true],
|
||||
['discussion_edit', null],
|
||||
];
|
||||
this.response.template = 'discussion_edit.html';
|
||||
this.response.body = { ddoc: this.ddoc, path };
|
||||
this.response.body = { ddoc: this.ddoc };
|
||||
}
|
||||
|
||||
@param('did', Types.ObjectId)
|
||||
|
||||
@@ -84,9 +84,11 @@ export async function get<T extends Field>(
|
||||
}
|
||||
|
||||
export async function edit(domainId: string, did: ObjectId, $set: Partial<DiscussionDoc>) {
|
||||
if ($set.content) {
|
||||
await coll.insertOne({
|
||||
domainId, docId: did, content: $set.content, uid: $set.editor, ip: $set.ip, time: new Date(),
|
||||
});
|
||||
}
|
||||
return document.set(domainId, document.TYPE_DISCUSSION, did, $set);
|
||||
}
|
||||
|
||||
|
||||
@@ -615,4 +615,8 @@ export const coreScripts: MigrationScript[] = [
|
||||
});
|
||||
return true;
|
||||
},
|
||||
async function _94_95() {
|
||||
await discussion.coll.deleteMany({ content: { $not: { $type: 'string' } } });
|
||||
return true;
|
||||
},
|
||||
];
|
||||
Reference in new issue
Block a user