diff --git a/packages/hydrooj/package.json b/packages/hydrooj/package.json index 4de8f5eb1..81a7d920e 100644 --- a/packages/hydrooj/package.json +++ b/packages/hydrooj/package.json @@ -1,6 +1,6 @@ { "name": "hydrooj", - "version": "2.20.45", + "version": "2.20.46", "bin": "bin/hydrooj.js", "main": "dist/loader.js", "typings": "dist/loader.d.ts", diff --git a/packages/hydrooj/src/handler/discussion.ts b/packages/hydrooj/src/handler/discussion.ts index e32663bc4..3feca7f4e 100644 --- a/packages/hydrooj/src/handler/discussion.ts +++ b/packages/hydrooj/src/handler/discussion.ts @@ -343,8 +343,8 @@ class DiscussionEditHandler extends DiscussionHandler { ) { if (this.ddoc.owner !== this.user._id) this.checkPerm(PERM.PERM_EDIT_DISCUSSION); else this.checkPerm(PERM.PERM_EDIT_DISCUSSION_SELF); - if (highlight !== this.ddoc.highlight) this.checkPerm(PERM.PERM_HIGHLIGHT_DISCUSSION); - if (pin !== this.ddoc.pin) this.checkPerm(PERM.PERM_PIN_DISCUSSION); + if (!this.user.hasPerm(PERM.PERM_HIGHLIGHT_DISCUSSION)) highlight = this.ddoc.highlight; + if (!this.user.hasPerm(PERM.PERM_PIN_DISCUSSION)) pin = this.ddoc.pin; await discussion.edit(domainId, did, title, content, highlight, pin); this.response.body = { did }; this.response.redirect = this.url('discussion_detail', { did }); diff --git a/packages/hydrooj/src/upgrade.ts b/packages/hydrooj/src/upgrade.ts index ba2b1d568..031571077 100644 --- a/packages/hydrooj/src/upgrade.ts +++ b/packages/hydrooj/src/upgrade.ts @@ -227,6 +227,11 @@ const scripts: UpgradeScript[] = [ await db.collection('domain.user').updateMany({ role: 'admin' }, { $set: { role: 'root' } }); 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;