[cm6] rename to Code Editor | Visual Editor (#13513)

* [cm6] rename to Code Editor | Visual Editor

* showLegacySourceEditor change

* show info badge

* remove info badge

* display info badge

* use "Visual Editor" in example project

GitOrigin-RevId: 549e25aa4bcfe58522eadc70e35ca35f822317b1
This commit is contained in:
Domagoj Kriskovic
2023-06-19 13:24:01 +02:00
committed by Copybot
parent 618293c599
commit dba1bfdcc1
6 changed files with 11 additions and 90 deletions
@@ -38,8 +38,6 @@ const InstitutionsFeatures = require('../Institutions/InstitutionsFeatures')
const ProjectAuditLogHandler = require('./ProjectAuditLogHandler')
const PublicAccessLevels = require('../Authorization/PublicAccessLevels')
const VISUAL_EDITOR_NAMING_SPLIT_TEST_MIN_SIGNUP_DATE = new Date('2023-04-17')
/**
* @typedef {import("./types").GetProjectsRequest} GetProjectsRequest
* @typedef {import("./types").GetProjectsResponse} GetProjectsResponse
@@ -558,60 +556,6 @@ const ProjectController = {
}
)
},
participatingInVisualEditorNamingTest: [
'user',
(results, cb) => {
const isNewUser =
results.user.signUpDate >=
VISUAL_EDITOR_NAMING_SPLIT_TEST_MIN_SIGNUP_DATE
cb(null, isNewUser)
},
],
visualEditorNameAssignment: [
'participatingInVisualEditorNamingTest',
(results, cb) => {
if (!results.participatingInVisualEditorNamingTest) {
cb(null, { variant: 'default' })
} else {
SplitTestHandler.getAssignment(
req,
res,
'visual-editor-name',
(error, assignment) => {
if (error) {
cb(null, { variant: 'default' })
} else {
cb(null, assignment)
}
}
)
}
},
],
legacySourceEditorAssignment: [
'participatingInVisualEditorNamingTest',
'visualEditorNameAssignment',
(results, cb) => {
// Hide Ace for people in the Rich Text naming test
if (results.participatingInVisualEditorNamingTest) {
cb(null, { variant: 'true' })
} else {
SplitTestHandler.getAssignment(
req,
res,
'source-editor-legacy',
(error, assignment) => {
// do not fail editor load if assignment fails
if (error) {
cb(null, { variant: 'default' })
} else {
cb(null, assignment)
}
}
)
}
},
],
pdfjsAssignment(cb) {
SplitTestHandler.getAssignment(
req,
@@ -848,9 +792,6 @@ const ProjectController = {
isTokenMember,
isInvitedMember,
brandVariation,
visualEditorNameAssignment,
participatingInVisualEditorNamingTest,
legacySourceEditorAssignment,
pdfjsAssignment,
editorLeftMenuAssignment,
richTextAssignment,
@@ -941,10 +882,7 @@ const ProjectController = {
const showLegacySourceEditor =
!Features.hasFeature('saas') ||
// Allow override via legacy_source_editor=true in query string
shouldDisplayFeature('legacy_source_editor') ||
// Hide Ace for beta users
(!user.betaProgram &&
legacySourceEditorAssignment.variant === 'default')
shouldDisplayFeature('legacy_source_editor')
const editorLeftMenuReact =
editorLeftMenuAssignment?.variant === 'react'
@@ -980,10 +918,6 @@ const ProjectController = {
? 'project/editor_detached'
: 'project/editor'
const isParticipatingInVisualEditorNamingTest =
Features.hasFeature('saas') &&
participatingInVisualEditorNamingTest
let richTextVariant
if (!Features.hasFeature('saas')) {
richTextVariant = 'cm6'
@@ -1050,8 +984,6 @@ const ProjectController = {
showTemplatesServerPro,
pdfjsVariant: pdfjsAssignment.variant,
debugPdfDetach,
isParticipatingInVisualEditorNamingTest,
visualEditorNameVariant: visualEditorNameAssignment.variant,
showLegacySourceEditor,
showSymbolPalette,
galileoEnabled,