From f92e44a261c7b1866ec90c22b3ed7038e7060e57 Mon Sep 17 00:00:00 2001 From: Brian Gough Date: Thu, 3 Feb 2022 14:21:42 +0000 Subject: [PATCH] Merge pull request #6596 from overleaf/bg-initial-cm6-split-test [web] initial split test for cm6 source editor GitOrigin-RevId: 05d0f9db8abcd93ea66326378854b23f27dc9d73 --- .../src/Features/Project/ProjectController.js | 25 ++++++++++++++++--- 1 file changed, 21 insertions(+), 4 deletions(-) diff --git a/services/web/app/src/Features/Project/ProjectController.js b/services/web/app/src/Features/Project/ProjectController.js index 115d089a7d..6ea7c47e6b 100644 --- a/services/web/app/src/Features/Project/ProjectController.js +++ b/services/web/app/src/Features/Project/ProjectController.js @@ -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, @@ -812,6 +827,7 @@ const ProjectController = { isTokenMember, brandVariation, newPdfPreviewAssignment, + newSourceEditorAssignment, } ) => { if (err != null) { @@ -916,6 +932,10 @@ const ProjectController = { 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', { title: project.name, priority_title: true, @@ -978,10 +998,7 @@ const ProjectController = { showPdfDetach, debugPdfDetach, showNewPdfPreview, - showNewSourceEditor: shouldDisplayFeature( - 'new_source_editor', - false - ), + showNewSourceEditor, trackPdfDownload: partOfPdfCachingRollout('collect-metrics'), enablePdfCaching: partOfPdfCachingRollout('enable-caching'), resetServiceWorker: