From 1a36b1a85daf2bd970002d1b54df1b4f02f787ca Mon Sep 17 00:00:00 2001 From: GingerPlusPlus Date: Fri, 31 May 2019 14:09:22 +0200 Subject: [PATCH] Refuse to ban and warn admins on datastore level --- stores/user.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/stores/user.js b/stores/user.js index ea32f63..7923797 100644 --- a/stores/user.js +++ b/stores/user.js @@ -111,7 +111,7 @@ const isAdmin = (user) => { const ban = ({ id }, ban_details) => User.update( - { id }, + { id, $not: { status: 'admin' } }, { $set: { ban_details, status: 'banned' } }, { upsert: true } ); @@ -141,7 +141,7 @@ const isBanned = ({ id }) => const warn = ({ id }, reason) => User.update( - { id }, + { id, $not: { status: 'admin' } }, { $push: { warns: reason } }, { returnUpdatedDocs: true } ).then(getUpdatedDocument);