Przeglądaj źródła

Merge pull request #29496 from overleaf/dp-remove-new-editor-old-logs

Move all new editor users to new logs

GitOrigin-RevId: 224a4476eddb6576eaa04086a68b6579650a1bc5
David 9 miesięcy temu
rodzic
commit
6aa9e5c855

+ 0 - 19
services/web/frontend/js/features/ide-redesign/utils/new-editor-utils.ts

@@ -41,18 +41,6 @@ export const canUseNewEditor = () => {
   )
 }
 
-const canUseNewLogs = () => {
-  const newUserTestVariant = getSplitTestVariant('editor-redesign-new-users')
-  const canUseNewLogsViaNewUserFeatureFlag =
-    isNewUser() &&
-    (newUserTestVariant === 'new-editor' ||
-      newUserTestVariant === 'new-editor-new-logs-old-position')
-
-  return (
-    canUseNewEditorViaPrimaryFeatureFlag() || canUseNewLogsViaNewUserFeatureFlag
-  )
-}
-
 export const useIsNewEditorEnabledViaPrimaryFeatureFlag = () => {
   const { userSettings } = useUserSettingsContext()
   const hasAccess = canUseNewEditorViaPrimaryFeatureFlag()
@@ -67,15 +55,8 @@ export const useIsNewEditorEnabled = () => {
   return hasAccess && enabled
 }
 
-export const useAreNewErrorLogsEnabled = () => {
-  const newEditorEnabled = useIsNewEditorEnabled()
-  return newEditorEnabled && canUseNewLogs()
-}
-
 export function useNewEditorVariant() {
   const newEditor = useIsNewEditorEnabled()
-  const newErrorLogs = useAreNewErrorLogsEnabled()
   if (!newEditor) return 'default'
-  if (!newErrorLogs) return 'new-editor-old-logs'
   return 'new-editor-new-logs-old-position'
 }

+ 3 - 3
services/web/frontend/js/features/pdf-preview/components/pdf-log-entry.tsx

@@ -4,9 +4,9 @@ import PdfLogEntryContent from './pdf-log-entry-content'
 import HumanReadableLogsHints from '../../../ide/human-readable-logs/HumanReadableLogsHints'
 import getMeta from '@/utils/meta'
 import { ErrorLevel, LogEntry, SourceLocation } from '../util/types'
-import { useAreNewErrorLogsEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
 import NewLogEntry from '@/features/ide-redesign/components/error-logs/log-entry'
 import { useEditorAnalytics } from '@/shared/hooks/use-editor-analytics'
+import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
 
 function PdfLogEntry({
   autoExpand,
@@ -71,9 +71,9 @@ function PdfLogEntry({
       [level, onSourceLocationClick, ruleId, sourceLocation, sendEvent]
     )
 
-  const newErrorlogs = useAreNewErrorLogsEnabled()
+  const newEditor = useIsNewEditorEnabled()
 
-  if (newErrorlogs) {
+  if (newEditor) {
     return (
       <NewLogEntry
         autoExpand={autoExpand}

+ 3 - 7
services/web/frontend/js/features/pdf-preview/components/pdf-preview-pane.tsx

@@ -9,10 +9,7 @@ import { PdfPreviewMessages } from './pdf-preview-messages'
 import CompileTimeWarningUpgradePrompt from './compile-time-warning-upgrade-prompt'
 import { PdfPreviewProvider } from './pdf-preview-provider'
 import PdfPreviewHybridToolbarNew from '@/features/ide-redesign/components/pdf-preview/pdf-preview-hybrid-toolbar'
-import {
-  useAreNewErrorLogsEnabled,
-  useIsNewEditorEnabled,
-} from '@/features/ide-redesign/utils/new-editor-utils'
+import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
 import importOverleafModules from '../../../../macros/import-overleaf-module.macro'
 import PdfCodeCheckFailedBanner from '@/features/ide-redesign/components/pdf-preview/pdf-code-check-failed-banner'
 import getMeta from '@/utils/meta'
@@ -26,7 +23,6 @@ function PdfPreviewPane() {
     'pdf-empty': !pdfUrl,
   })
   const newEditor = useIsNewEditorEnabled()
-  const newErrorLogs = useAreNewErrorLogsEnabled()
 
   const pdfPromotions = importOverleafModules('pdfPreviewPromotions') as {
     import: { default: ElementType }
@@ -41,7 +37,7 @@ function PdfPreviewPane() {
         ) : (
           <PdfHybridPreviewToolbar />
         )}
-        {newErrorLogs && <PdfCodeCheckFailedBanner />}
+        {newEditor && <PdfCodeCheckFailedBanner />}
         <PdfPreviewMessages>
           {compileTimeout < 60 && <CompileTimeWarningUpgradePrompt />}
         </PdfPreviewMessages>
@@ -51,7 +47,7 @@ function PdfPreviewPane() {
             <ClsiCachePrompt />
           </div>
         </Suspense>
-        {newErrorLogs ? <NewPdfLogsViewer /> : <PdfLogsViewer />}
+        {newEditor ? <NewPdfLogsViewer /> : <PdfLogsViewer />}
         {pdfPromotions.map(({ import: { default: Component }, path }) => (
           <Component key={path} />
         ))}

+ 4 - 4
services/web/frontend/js/features/pdf-preview/hooks/use-log-events.ts

@@ -1,8 +1,8 @@
 import { useCallback } from 'react'
 import { useLayoutContext } from '@/shared/context/layout-context'
-import { useAreNewErrorLogsEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
 import { useEditorContext } from '@/shared/context/editor-context'
 import useEventListener from '@/shared/hooks/use-event-listener'
+import { useIsNewEditorEnabled } from '@/features/ide-redesign/utils/new-editor-utils'
 
 function scrollIntoView(element: Element) {
   setTimeout(() => {
@@ -18,7 +18,7 @@ function scrollIntoView(element: Element) {
  */
 export const useLogEvents = (setShowLogs: (show: boolean) => void) => {
   const { pdfLayout, setView } = useLayoutContext()
-  const newLogs = useAreNewErrorLogsEnabled()
+  const newEditor = useIsNewEditorEnabled()
   const { hasPremiumSuggestion } = useEditorContext()
 
   const selectLogOldLogs = useCallback((id: string, suggestFix: boolean) => {
@@ -117,7 +117,7 @@ export const useLogEvents = (setShowLogs: (show: boolean) => void) => {
 
       openLogs()
 
-      if (newLogs) {
+      if (newEditor) {
         selectLogNewLogs(
           id,
           Boolean(suggestFix),
@@ -127,7 +127,7 @@ export const useLogEvents = (setShowLogs: (show: boolean) => void) => {
         selectLogOldLogs(id, Boolean(suggestFix))
       }
     },
-    [openLogs, selectLogNewLogs, selectLogOldLogs, newLogs]
+    [openLogs, selectLogNewLogs, selectLogOldLogs, newEditor]
   )
 
   useEventListener(

+ 1 - 1
services/web/test/frontend/components/pdf-preview/new-editor-utils.test.tsx

@@ -14,7 +14,7 @@ describe('new-editor-utils', function () {
       },
       {
         splitTestVariant: 'new-editor-old-logs',
-        uiVariant: 'new-editor-old-logs',
+        uiVariant: 'new-editor-new-logs-old-position',
       },
       {
         splitTestVariant: 'new-editor-new-logs-old-position',