2018-04-19 12:54:34 +03:00
|
|
|
const mongo = require('mongodb');
|
|
|
|
const User = require('../built/models/user').default;
|
|
|
|
|
|
|
|
const args = process.argv.slice(2);
|
|
|
|
|
2018-06-06 22:31:49 +03:00
|
|
|
const user = args[0];
|
2018-04-19 12:54:34 +03:00
|
|
|
|
2018-06-06 22:31:49 +03:00
|
|
|
const q = user.startsWith('@') ? {
|
|
|
|
username: user.split('@')[1],
|
2018-06-06 22:33:39 +03:00
|
|
|
host: user.split('@')[2] || null
|
2018-06-06 22:31:49 +03:00
|
|
|
} : { _id: new mongo.ObjectID(user) };
|
2018-04-19 12:54:34 +03:00
|
|
|
|
2018-06-06 22:31:49 +03:00
|
|
|
console.log(`Suspending ${user}...`);
|
|
|
|
|
|
|
|
User.update(q, {
|
2018-04-19 12:54:34 +03:00
|
|
|
$set: {
|
|
|
|
isSuspended: true
|
|
|
|
}
|
|
|
|
}).then(() => {
|
2018-06-06 22:31:49 +03:00
|
|
|
console.log(`Suspended ${user}`);
|
2018-04-19 12:54:34 +03:00
|
|
|
}, e => {
|
|
|
|
console.error(e);
|
|
|
|
});
|