Merge pull request #1610 from sharelatex/cmg-reintroduce-beta

Revive the beta program in the settings area

GitOrigin-RevId: 40024210cba08de96805d58147b6a0fe166a7d43
This commit is contained in:
Simon Detheridge
2019-03-22 12:28:36 +00:00
committed by sharelatex
parent 2bf6e4e072
commit d2e053f456
5 changed files with 64 additions and 20 deletions
@@ -0,0 +1,49 @@
const fs = require('fs')
const mongojs = require('../../app/js/infrastructure/mongojs')
const { db, ObjectId } = mongojs
const async = require('async')
console.log('Finding users for ids specified')
const text = fs.readFileSync(__dirname + '/beta-users.txt')
const textByLine = text
.toString()
.split('\n')
.map(function(stringId) {
return ObjectId(stringId)
})
db.users.find({ _id: { $in: textByLine } }, function(err, users) {
if (err) throw err
if (users.length) {
console.log('Found ' + users.length + ' users')
async.each(
users,
function(user, callback) {
console.log('setting betaProgram==true for: ' + user._id)
db.users.update(
{
_id: user._id
},
{
$set: {
betaProgram: true
}
},
callback
)
},
function(result, err) {
if (err) {
console.log(err)
}
process.exit(0)
}
)
} else {
console.log('No users found matching those ids')
process.exit(0)
}
})