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:21:00 +00:00 committed by sharelatex
parent 2bf6e4e072
commit d2e053f456
5 changed files with 64 additions and 20 deletions

View file

@ -391,7 +391,7 @@ module.exports = ProjectController =
editorThemes: THEME_LIST
maxDocLength: Settings.max_doc_length
useV2History: !!project.overleaf?.history?.display
richTextTrackChangesEnabled: req.query?.rttc == 'true'
richTextTrackChangesEnabled: req.query?.rttc == 'true' || user.betaProgram
showTestControls: req.query?.tc == 'true' || user.isAdmin
brandVariation: brandVariation
allowedImageNames: Settings.allowedImageNames || []

View file

@ -382,9 +382,9 @@ module.exports = class Router
}), ReferencesController.indexAll
# disable beta program while v2 is in beta
# webRouter.get "/beta/participate", AuthenticationController.requireLogin(), BetaProgramController.optInPage
# webRouter.post "/beta/opt-in", AuthenticationController.requireLogin(), BetaProgramController.optIn
# webRouter.post "/beta/opt-out", AuthenticationController.requireLogin(), BetaProgramController.optOut
webRouter.get "/beta/participate", AuthenticationController.requireLogin(), BetaProgramController.optInPage
webRouter.post "/beta/opt-in", AuthenticationController.requireLogin(), BetaProgramController.optIn
webRouter.post "/beta/opt-out", AuthenticationController.requireLogin(), BetaProgramController.optOut
webRouter.get "/confirm-password", AuthenticationController.requireLogin(), SudoModeController.sudoModePrompt
webRouter.post "/confirm-password",
AuthenticationController.requireLogin(),

View file

@ -17,8 +17,6 @@ block content
p.text-centered
| #{translate("beta_program_badge_description")}
span.beta-feature-badge
p.text-centered
strong We're currently testing lower latency compilation features in beta.
.row.text-centered
.col-md-12
if user.betaProgram

View file

@ -144,20 +144,17 @@ block content
) #{translate("change")}
| !{moduleIncludes("userSettings", locals)}
//- The beta program doesn't make much sense to include while v2 is going
//- but we may want to add it back in later
//- hr
//-
//- h3
//- | #{translate("sharelatex_beta_program")}
//-
//- if (user.betaProgram)
//- p.small
//- | #{translate("beta_program_already_participating")}
//-
//- div
//- a(id="beta-program-participate-link" href="/beta/participate") #{translate("manage_beta_program_membership")}
hr
h3
| #{translate("sharelatex_beta_program")}
if (user.betaProgram)
p.small
| #{translate("beta_program_already_participating")}
div
a(id="beta-program-participate-link" href="/beta/participate") #{translate("manage_beta_program_membership")}
hr

View file

@ -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)
}
})