Prepare React Pdf Preview Rollout with Split Test (#5746)

Prepare React Pdf Preview Rollout with Split Test and disabled new Logs UI

GitOrigin-RevId: 995b7ca3ed542e58596b9f9715adc93a64da597e
This commit is contained in:
Miguel Serrano 2021-11-11 12:20:06 +01:00 committed by Copybot
parent a6b9467f31
commit b7e9f0b67f
4 changed files with 33 additions and 3 deletions

View file

@ -38,6 +38,7 @@ function _getVariantForPercentile(percentile) {
} }
} }
// eslint-disable-next-line no-unused-vars
function getNewLogsUIVariantForUser(user) { function getNewLogsUIVariantForUser(user) {
const { _id: userId, alphaProgram: isAlphaUser } = user const { _id: userId, alphaProgram: isAlphaUser } = user
const isSaaS = Boolean(Settings.overleaf) const isSaaS = Boolean(Settings.overleaf)
@ -56,5 +57,7 @@ function getNewLogsUIVariantForUser(user) {
} }
module.exports = { module.exports = {
getNewLogsUIVariantForUser, // We're disabling the split tests while rolling out the PDF Preview
// https://github.com/overleaf/internal/issues/5553
getNewLogsUIVariantForUser: () => EXISTING_UI,
} }

View file

@ -733,8 +733,27 @@ const ProjectController = {
} }
) )
}, },
newPdfPreviewAssignment(cb) {
SplitTestV2Handler.getAssignmentForSession(
req.session,
'react-pdf-preview-rollout',
(err, assignment) => {
cb(err, assignment)
}
)
},
}, },
(err, { project, user, subscription, isTokenMember, brandVariation }) => { (
err,
{
project,
user,
subscription,
isTokenMember,
brandVariation,
newPdfPreviewAssignment,
}
) => {
if (err != null) { if (err != null) {
OError.tag(err, 'error getting details for project page') OError.tag(err, 'error getting details for project page')
return next(err) return next(err)
@ -821,7 +840,7 @@ const ProjectController = {
let showNewPdfPreview = shouldDisplayFeature( let showNewPdfPreview = shouldDisplayFeature(
'new_pdf_preview', 'new_pdf_preview',
user.alphaProgram newPdfPreviewAssignment.variant === 'react-pdf-preview'
) )
const showPdfDetach = shouldDisplayFeature( const showPdfDetach = shouldDisplayFeature(

View file

@ -9,6 +9,11 @@ const MODULE_PATH = require('path').join(
describe('NewLogsUI helper', function () { describe('NewLogsUI helper', function () {
let NewLogsUI let NewLogsUI
before(function () {
// We're disabling the Logs UI split test while rolling out the PDF Preview
this.skip()
})
function userIdFromTime(time) { function userIdFromTime(time) {
return ObjectId.createFromTime(time).toString() return ObjectId.createFromTime(time).toString()
} }

View file

@ -139,6 +139,9 @@ describe('ProjectController', function () {
getAssignment: sinon.stub().resolves({ active: false }), getAssignment: sinon.stub().resolves({ active: false }),
assignInLocalsContext: sinon.stub().resolves(), assignInLocalsContext: sinon.stub().resolves(),
}, },
getAssignmentForSession: sinon
.stub()
.yields(null, { variant: 'variant' }),
getAssignment: sinon.stub().yields(null, { active: false }), getAssignment: sinon.stub().yields(null, { active: false }),
assignInLocalsContext: sinon.stub().yields(null), assignInLocalsContext: sinon.stub().yields(null),
} }