File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -155,10 +155,10 @@ module.exports = (config) => {
155
155
156
156
const _id = user . _id
157
157
if ( ! remove ) {
158
- if ( user . active === 0 ) {
158
+ if ( user . banned ) {
159
159
return `User "${ username } " ${ _id } is already banned.`
160
160
}
161
- await db . users . update ( { _id } , { $set : { active : 0 } } )
161
+ await db . users . update ( { _id } , { $set : { active : 0 , banned : true } } )
162
162
console . log ( `Suspended user "${ username } " ${ _id } ` )
163
163
return `Suspended user "${ username } " ${ _id } `
164
164
} else {
@@ -180,7 +180,7 @@ module.exports = (config) => {
180
180
return `User "${ username } " ${ user . _id } is not banned.`
181
181
}
182
182
183
- await db . users . update ( { _id : user . _id } , { $set : { active : 10000 } } )
183
+ await db . users . update ( { _id : user . _id } , { $set : { active : 10000 , banned : false } } )
184
184
console . log ( `Unbanned user "${ username } " ${ user . _id } ` )
185
185
return `Unbanned user "${ username } " ${ user . _id } `
186
186
}
Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ module.exports = (config) => {
5
5
const WHITELIST = JSON . parse ( await env . get ( env . keys . WHITELIST ) || '[]' ) . map ( u => u . toLowerCase ( ) )
6
6
const users = await db . users . find ( )
7
7
for ( const user of users ) {
8
- const blocked = ! ( user . allowed || WHITELIST . length === 0 || ( user . username && WHITELIST . includes ( user . username . toLowerCase ( ) ) ) )
8
+ const blocked = ! ( user . allowed || ! user . banned || WHITELIST . length === 0 || ( user . username && WHITELIST . includes ( user . username . toLowerCase ( ) ) ) )
9
9
db . users . update ( { _id : user . _id } , { $set : { blocked } } )
10
10
}
11
11
} ]
You can’t perform that action at this time.
0 commit comments