core: fix discussion history

This commit is contained in:
undefined committed 2025-06-25 04:08:33 +08:00
1 parent 273ff95222
commit be72cac27f
3 files changed
+7 -8

No files matched your search

+1 -8
View File
@@ -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)
+2
View File
@@ -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);
}
+4
View File
@@ -615,4 +615,8 @@ export const coreScripts: MigrationScript[] = [
});
return true;
},
async function _94_95() {
await discussion.coll.deleteMany({ content: { $not: { $type: 'string' } } });
return true;
},
];