mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-13 21:53:43 +01:00
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:
committed by
sharelatex
parent
2bf6e4e072
commit
d2e053f456
@@ -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)
|
||||
}
|
||||
})
|
||||
Reference in New Issue
Block a user