Node.js based forum software built for the modern web
fix: #9085, dont prevent admins from deleting other users
Barış Soner Uşaklı0f480be6580f
diff --git a/public/language/en-GB/error.json b/public/language/en-GB/error.jsonindex 8782c9d665..63b5ebdee5 100644--- a/public/language/en-GB/error.json+++ b/public/language/en-GB/error.json@@ -107,6 +107,7 @@"cant-ban-other-admins": "You can't ban other admins!","cant-remove-last-admin": "You are the only administrator. Add another user as an administrator before removing yourself as admin",+ "account-deletion-disabled": "Account deletion is disabled","cant-delete-admin": "Remove administrator privileges from this account before attempting to delete it.","already-deleting": "Already deleting",diff --git a/src/api/users.js b/src/api/users.jsindex 6b763f1118..d65f450d29 100644--- a/src/api/users.js+++ b/src/api/users.js@@ -250,8 +250,8 @@ async function processDeletion({ uid, method, password, caller }) {const isSelf = parseInt(uid, 10) === caller.uid;const isAdmin = await user.isAdministrator(caller.uid);- if (meta.config.allowAccountDelete !== 1) {- throw new Error('[[error:no-privileges]]');+ if (isSelf && meta.config.allowAccountDelete !== 1) {+ throw new Error('[[error:account-deletion-disabled]]');} else if (!isSelf && !isAdmin) {throw new Error('[[error:no-privileges]]');} else if (isTargetAdmin) {