Merge pull request #6596 from overleaf/bg-initial-cm6-split-test

[web] initial split test for cm6 source editor

GitOrigin-RevId: 05d0f9db8abcd93ea66326378854b23f27dc9d73
This commit is contained in:
Brian Gough 2022-02-03 14:21:42 +00:00 committed by Copybot
parent 6ce0df3106
commit f92e44a261

View file

@ -801,6 +801,21 @@ const ProjectController = {
} }
) )
}, },
newSourceEditorAssignment(cb) {
SplitTestHandler.getAssignment(
req,
'source-editor',
{},
(error, assignment) => {
// do not fail editor load if assignment fails
if (error) {
cb(null)
} else {
cb(null, assignment)
}
}
)
},
}, },
( (
err, err,
@ -812,6 +827,7 @@ const ProjectController = {
isTokenMember, isTokenMember,
brandVariation, brandVariation,
newPdfPreviewAssignment, newPdfPreviewAssignment,
newSourceEditorAssignment,
} }
) => { ) => {
if (err != null) { if (err != null) {
@ -916,6 +932,10 @@ const ProjectController = {
detachRole = req.params.detachRole detachRole = req.params.detachRole
} }
const showNewSourceEditor =
(newSourceEditorAssignment &&
newSourceEditorAssignment.variant === 'codemirror') ||
shouldDisplayFeature('new_source_editor', false) // also allow override via ?new_source_editor=true
res.render('project/editor', { res.render('project/editor', {
title: project.name, title: project.name,
priority_title: true, priority_title: true,
@ -978,10 +998,7 @@ const ProjectController = {
showPdfDetach, showPdfDetach,
debugPdfDetach, debugPdfDetach,
showNewPdfPreview, showNewPdfPreview,
showNewSourceEditor: shouldDisplayFeature( showNewSourceEditor,
'new_source_editor',
false
),
trackPdfDownload: partOfPdfCachingRollout('collect-metrics'), trackPdfDownload: partOfPdfCachingRollout('collect-metrics'),
enablePdfCaching: partOfPdfCachingRollout('enable-caching'), enablePdfCaching: partOfPdfCachingRollout('enable-caching'),
resetServiceWorker: resetServiceWorker: