diff --git a/services/web/app/src/Features/Compile/CompileManager.js b/services/web/app/src/Features/Compile/CompileManager.js index 454dc97d16..0266afc4ed 100644 --- a/services/web/app/src/Features/Compile/CompileManager.js +++ b/services/web/app/src/Features/Compile/CompileManager.js @@ -167,26 +167,28 @@ module.exports = CompileManager = { if (error != null) { return callback(error) } - return UserGetter.getUser(project.owner_ref, { features: 1 }, function( - err, - owner - ) { - if (error != null) { - return callback(error) + return UserGetter.getUser( + project.owner_ref, + { alphaProgram: 1, betaProgram: 1, features: 1 }, + function(err, owner) { + if (error != null) { + return callback(error) + } + let ownerFeatures = (owner && owner.features) || {} + // put alpha users into their own compile group + if (owner && owner.alphaProgram) { + ownerFeatures.compileGroup = 'alpha' + } + return callback(null, { + timeout: + ownerFeatures.compileTimeout || + Settings.defaultFeatures.compileTimeout, + compileGroup: + ownerFeatures.compileGroup || + Settings.defaultFeatures.compileGroup + }) } - return callback(null, { - timeout: - __guard__( - owner != null ? owner.features : undefined, - x => x.compileTimeout - ) || Settings.defaultFeatures.compileTimeout, - compileGroup: - __guard__( - owner != null ? owner.features : undefined, - x1 => x1.compileGroup - ) || Settings.defaultFeatures.compileGroup - }) - }) + ) }) }, @@ -271,9 +273,3 @@ module.exports = CompileManager = { }) } } - -function __guard__(value, transform) { - return typeof value !== 'undefined' && value !== null - ? transform(value) - : undefined -} diff --git a/services/web/app/src/models/User.js b/services/web/app/src/models/User.js index 73766fd352..834eaaacb2 100644 --- a/services/web/app/src/models/User.js +++ b/services/web/app/src/models/User.js @@ -134,6 +134,7 @@ const UserSchema = new Schema({ mendeley: Boolean, // coerce the refProviders values to Booleans zotero: Boolean }, + alphaProgram: { type: Boolean, default: false }, // experimental features betaProgram: { type: Boolean, default: false }, overleaf: { id: { type: Number }, diff --git a/services/web/test/unit/src/Compile/CompileManagerTests.js b/services/web/test/unit/src/Compile/CompileManagerTests.js index afadd137bb..ccf353b99a 100644 --- a/services/web/test/unit/src/Compile/CompileManagerTests.js +++ b/services/web/test/unit/src/Compile/CompileManagerTests.js @@ -215,7 +215,11 @@ describe('CompileManager', function() { it("should look up the owner's features", function() { return this.UserGetter.getUser - .calledWith(this.project.owner_ref, { features: 1 }) + .calledWith(this.project.owner_ref, { + alphaProgram: 1, + betaProgram: 1, + features: 1 + }) .should.equal(true) })