core: 修复discussion_edit行为

This commit is contained in:
undefined committed 2021-03-29 22:49:44 +08:00
1 parent 1472c1567c
commit 777d648f63
3 files changed
+8 -3

No files matched your search

+1 -1
View File
@@ -1,6 +1,6 @@
{ {
"name": "hydrooj", "name": "hydrooj",
"version": "2.20.45", "version": "2.20.46",
"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",
+2 -2
View File
@@ -343,8 +343,8 @@ class DiscussionEditHandler extends DiscussionHandler {
) { ) {
if (this.ddoc.owner !== this.user._id) this.checkPerm(PERM.PERM_EDIT_DISCUSSION); if (this.ddoc.owner !== this.user._id) this.checkPerm(PERM.PERM_EDIT_DISCUSSION);
else this.checkPerm(PERM.PERM_EDIT_DISCUSSION_SELF); else this.checkPerm(PERM.PERM_EDIT_DISCUSSION_SELF);
if (highlight !== this.ddoc.highlight) this.checkPerm(PERM.PERM_HIGHLIGHT_DISCUSSION); if (!this.user.hasPerm(PERM.PERM_HIGHLIGHT_DISCUSSION)) highlight = this.ddoc.highlight;
if (pin !== this.ddoc.pin) this.checkPerm(PERM.PERM_PIN_DISCUSSION); if (!this.user.hasPerm(PERM.PERM_PIN_DISCUSSION)) pin = this.ddoc.pin;
await discussion.edit(domainId, did, title, content, highlight, pin); await discussion.edit(domainId, did, title, content, highlight, pin);
this.response.body = { did }; this.response.body = { did };
this.response.redirect = this.url('discussion_detail', { did }); this.response.redirect = this.url('discussion_detail', { did });
+5
View File
@@ -227,6 +227,11 @@ const scripts: UpgradeScript[] = [
await db.collection('domain.user').updateMany({ role: 'admin' }, { $set: { role: 'root' } }); await db.collection('domain.user').updateMany({ role: 'admin' }, { $set: { role: 'root' } });
return true; return true;
}, },
async function _14_15() {
const _FRESH_INSTALL_IGNORE = 1;
await db.collection('domain.user').deleteMany({ uid: null });
await db.collection('domain.user').deleteMany({ uid: 0 });
},
]; ];
export = scripts; export = scripts;