Просмотр исходного кода

Merge pull request #9792 from overleaf/ds-jpa-remove-stoponfirsterror-split-test

Split Test removal - removed stop-on-first-error split test code

GitOrigin-RevId: 4a5663397d0a967e0fa957453b36d466aa530630
Tim Down 3 лет назад
Родитель
Сommit
de7eb43f51

+ 0 - 20
services/web/app/src/Features/Project/ProjectController.js

@@ -932,21 +932,6 @@ const ProjectController = {
             }
             }
           )
           )
         },
         },
-        stopOnFirstErrorAssignment(cb) {
-          SplitTestHandler.getAssignment(
-            req,
-            res,
-            'stop-on-first-error',
-            (error, assignment) => {
-              // do not fail editor load if assignment fails
-              if (error) {
-                cb(null, { variant: 'default' })
-              } else {
-                cb(null, assignment)
-              }
-            }
-          )
-        },
         interstitialPaymentFromPaywallAssignment(cb) {
         interstitialPaymentFromPaywallAssignment(cb) {
           SplitTestHandler.getAssignment(
           SplitTestHandler.getAssignment(
             req,
             req,
@@ -1072,7 +1057,6 @@ const ProjectController = {
           newSourceEditorAssignment,
           newSourceEditorAssignment,
           pdfjsAssignment,
           pdfjsAssignment,
           dictionaryEditorAssignment,
           dictionaryEditorAssignment,
-          stopOnFirstErrorAssignment,
         }
         }
       ) => {
       ) => {
         if (err != null) {
         if (err != null) {
@@ -1179,9 +1163,6 @@ const ProjectController = {
               !userIsMemberOfGroupSubscription &&
               !userIsMemberOfGroupSubscription &&
               !userHasInstitutionLicence
               !userHasInstitutionLicence
 
 
-            const showStopOnFirstError =
-              stopOnFirstErrorAssignment.variant === 'enabled'
-
             const template =
             const template =
               detachRole === 'detached'
               detachRole === 'detached'
                 ? 'project/editor_detached'
                 ? 'project/editor_detached'
@@ -1252,7 +1233,6 @@ const ProjectController = {
               showSymbolPalette,
               showSymbolPalette,
               galileoEnabled,
               galileoEnabled,
               galileoFeatures,
               galileoFeatures,
-              showStopOnFirstError,
               detachRole,
               detachRole,
               metadata: { viewport: false },
               metadata: { viewport: false },
               showUpgradePrompt,
               showUpgradePrompt,

+ 0 - 1
services/web/app/views/project/editor/meta.pug

@@ -26,7 +26,6 @@ meta(name="ol-galileoEnabled" data-type="string" content=galileoEnabled)
 meta(name="ol-galileoFeatures" data-type="json" content=galileoFeatures)
 meta(name="ol-galileoFeatures" data-type="json" content=galileoFeatures)
 meta(name="ol-detachRole" data-type="string" content=detachRole)
 meta(name="ol-detachRole" data-type="string" content=detachRole)
 meta(name="ol-showUpgradePrompt" data-type="boolean" content=showUpgradePrompt)
 meta(name="ol-showUpgradePrompt" data-type="boolean" content=showUpgradePrompt)
-meta(name="ol-showStopOnFirstError" data-type="boolean" content=showStopOnFirstError)
 
 
 - var fileActionI18n = ['edited', 'renamed', 'created', 'deleted'].reduce((acc, i) => {acc[i] = translate('file_action_' + i); return acc}, {})
 - var fileActionI18n = ['edited', 'renamed', 'created', 'deleted'].reduce((acc, i) => {acc[i] = translate('file_action_' + i); return acc}, {})
 meta(name="ol-fileActionI18n" data-type="json" content=fileActionI18n)
 meta(name="ol-fileActionI18n" data-type="json" content=fileActionI18n)

+ 0 - 3
services/web/frontend/extracted-translations.json

@@ -317,7 +317,6 @@
   "latex_help_guide": "",
   "latex_help_guide": "",
   "layout": "",
   "layout": "",
   "layout_processing": "",
   "layout_processing": "",
-  "learn_how_to_make_documents_compile_quickly": "",
   "learn_more": "",
   "learn_more": "",
   "learn_more_about_link_sharing": "",
   "learn_more_about_link_sharing": "",
   "leave": "",
   "leave": "",
@@ -346,8 +345,6 @@
   "log_entry_description": "",
   "log_entry_description": "",
   "log_entry_maximum_entries": "",
   "log_entry_maximum_entries": "",
   "log_entry_maximum_entries_enable_stop_on_first_error": "",
   "log_entry_maximum_entries_enable_stop_on_first_error": "",
-  "log_entry_maximum_entries_message": "",
-  "log_entry_maximum_entries_message_no_errors": "",
   "log_entry_maximum_entries_see_full_logs": "",
   "log_entry_maximum_entries_see_full_logs": "",
   "log_entry_maximum_entries_title": "",
   "log_entry_maximum_entries_title": "",
   "log_hint_extra_info": "",
   "log_hint_extra_info": "",

+ 11 - 19
services/web/frontend/js/features/pdf-preview/components/pdf-compile-button.js

@@ -7,7 +7,6 @@ import classnames from 'classnames'
 import { useDetachCompileContext as useCompileContext } from '../../../shared/context/detach-compile-context'
 import { useDetachCompileContext as useCompileContext } from '../../../shared/context/detach-compile-context'
 import { useStopOnFirstError } from '../../../shared/hooks/use-stop-on-first-error'
 import { useStopOnFirstError } from '../../../shared/hooks/use-stop-on-first-error'
 import PdfCompileButtonInner from './pdf-compile-button-inner'
 import PdfCompileButtonInner from './pdf-compile-button-inner'
-import getMeta from '../../../utils/meta'
 
 
 function PdfCompileButton() {
 function PdfCompileButton() {
   const {
   const {
@@ -30,7 +29,6 @@ function PdfCompileButton() {
     useStopOnFirstError({ eventSource: 'dropdown' })
     useStopOnFirstError({ eventSource: 'dropdown' })
 
 
   const { t } = useTranslation()
   const { t } = useTranslation()
-  const showStopOnFirstError = getMeta('ol-showStopOnFirstError')
 
 
   return (
   return (
     <ControlledDropdown
     <ControlledDropdown
@@ -95,23 +93,17 @@ function PdfCompileButton() {
           {t('ignore_validation_errors')}
           {t('ignore_validation_errors')}
         </MenuItem>
         </MenuItem>
 
 
-        {showStopOnFirstError && (
-          <MenuItem header>{t('compile_error_handling')}</MenuItem>
-        )}
-
-        {showStopOnFirstError && (
-          <MenuItem onSelect={enableStopOnFirstError}>
-            <Icon type={stopOnFirstError ? 'check' : ''} fw />
-            {t('stop_on_first_error')}
-          </MenuItem>
-        )}
-
-        {showStopOnFirstError && (
-          <MenuItem onSelect={disableStopOnFirstError}>
-            <Icon type={!stopOnFirstError ? 'check' : ''} fw />
-            {t('try_to_compile_despite_errors')}
-          </MenuItem>
-        )}
+        <MenuItem header>{t('compile_error_handling')}</MenuItem>
+
+        <MenuItem onSelect={enableStopOnFirstError}>
+          <Icon type={stopOnFirstError ? 'check' : ''} fw />
+          {t('stop_on_first_error')}
+        </MenuItem>
+
+        <MenuItem onSelect={disableStopOnFirstError}>
+          <Icon type={!stopOnFirstError ? 'check' : ''} fw />
+          {t('try_to_compile_despite_errors')}
+        </MenuItem>
 
 
         <MenuItem divider />
         <MenuItem divider />
 
 

+ 46 - 66
services/web/frontend/js/features/pdf-preview/components/pdf-preview-error.js

@@ -6,7 +6,6 @@ import PdfLogEntry from './pdf-log-entry'
 import { useDetachCompileContext as useCompileContext } from '../../../shared/context/detach-compile-context'
 import { useDetachCompileContext as useCompileContext } from '../../../shared/context/detach-compile-context'
 import { useStopOnFirstError } from '../../../shared/hooks/use-stop-on-first-error'
 import { useStopOnFirstError } from '../../../shared/hooks/use-stop-on-first-error'
 import StopOnFirstErrorBadge from '../../../shared/components/stop-on-first-error-badge'
 import StopOnFirstErrorBadge from '../../../shared/components/stop-on-first-error-badge'
-import getMeta from '../../../utils/meta'
 
 
 function PdfPreviewError({ error }) {
 function PdfPreviewError({ error }) {
   const { t } = useTranslation()
   const { t } = useTranslation()
@@ -181,7 +180,6 @@ function TimedOutLogEntry() {
   })
   })
   const { startCompile, lastCompileOptions, setAnimateCompileDropdownArrow } =
   const { startCompile, lastCompileOptions, setAnimateCompileDropdownArrow } =
     useCompileContext()
     useCompileContext()
-  const showStopOnFirstError = getMeta('ol-showStopOnFirstError')
 
 
   const handleEnableStopOnFirstErrorClick = useCallback(() => {
   const handleEnableStopOnFirstErrorClick = useCallback(() => {
     enableStopOnFirstError()
     enableStopOnFirstError()
@@ -189,74 +187,56 @@ function TimedOutLogEntry() {
     setAnimateCompileDropdownArrow(true)
     setAnimateCompileDropdownArrow(true)
   }, [enableStopOnFirstError, startCompile, setAnimateCompileDropdownArrow])
   }, [enableStopOnFirstError, startCompile, setAnimateCompileDropdownArrow])
 
 
-  if (showStopOnFirstError) {
-    return (
-      <ErrorLogEntry title={t('timedout')}>
-        <p>{t('project_timed_out_intro')}</p>
-        <ul>
-          <li>
-            <Trans
-              i18nKey="project_timed_out_optimize_images"
-              components={[
-                // eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-key
-                <a href="https://www.overleaf.com/learn/how-to/Optimising_very_large_image_files" />,
-              ]}
-            />
-          </li>
-          <li>
-            <Trans
-              i18nKey="project_timed_out_fatal_error"
-              components={[
-                // eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-key
-                <a href="https://www.overleaf.com/learn/how-to/Why_do_I_keep_getting_the_compile_timeout_error_message%3F#Fatal_compile_errors_blocking_the_compilation" />,
-              ]}
-            />
-            {!lastCompileOptions.stopOnFirstError && (
-              <>
-                {' '}
-                <Trans
-                  i18nKey="project_timed_out_enable_stop_on_first_error"
-                  components={[
-                    // eslint-disable-next-line react/jsx-key
-                    <Button
-                      bsSize="xs"
-                      bsStyle="info"
-                      onClick={handleEnableStopOnFirstErrorClick}
-                    />,
-                  ]}
-                />{' '}
-                <StopOnFirstErrorBadge placement="bottom" />
-              </>
-            )}
-          </li>
-        </ul>
-        <p>
+  return (
+    <ErrorLogEntry title={t('timedout')}>
+      <p>{t('project_timed_out_intro')}</p>
+      <ul>
+        <li>
           <Trans
           <Trans
-            i18nKey="project_timed_out_learn_more"
+            i18nKey="project_timed_out_optimize_images"
             components={[
             components={[
               // eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-key
               // eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-key
-              <a href="https://www.overleaf.com/learn/how-to/Why_do_I_keep_getting_the_compile_timeout_error_message%3F" />,
+              <a href="https://www.overleaf.com/learn/how-to/Optimising_very_large_image_files" />,
             ]}
             ]}
           />
           />
-        </p>
-      </ErrorLogEntry>
-    )
-  } else {
-    return (
-      <ErrorLogEntry title={t('timedout')}>
-        {t('proj_timed_out_reason')}
-
-        <div>
-          <a
-            href="https://www.overleaf.com/learn/how-to/Why_do_I_keep_getting_the_compile_timeout_error_message%3F"
-            target="_blank"
-            rel="noopener"
-          >
-            {t('learn_how_to_make_documents_compile_quickly')}
-          </a>
-        </div>
-      </ErrorLogEntry>
-    )
-  }
+        </li>
+        <li>
+          <Trans
+            i18nKey="project_timed_out_fatal_error"
+            components={[
+              // eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-key
+              <a href="https://www.overleaf.com/learn/how-to/Why_do_I_keep_getting_the_compile_timeout_error_message%3F#Fatal_compile_errors_blocking_the_compilation" />,
+            ]}
+          />
+          {!lastCompileOptions.stopOnFirstError && (
+            <>
+              {' '}
+              <Trans
+                i18nKey="project_timed_out_enable_stop_on_first_error"
+                components={[
+                  // eslint-disable-next-line react/jsx-key
+                  <Button
+                    bsSize="xs"
+                    bsStyle="info"
+                    onClick={handleEnableStopOnFirstErrorClick}
+                  />,
+                ]}
+              />{' '}
+              <StopOnFirstErrorBadge placement="bottom" />
+            </>
+          )}
+        </li>
+      </ul>
+      <p>
+        <Trans
+          i18nKey="project_timed_out_learn_more"
+          components={[
+            // eslint-disable-next-line jsx-a11y/anchor-has-content, react/jsx-key
+            <a href="https://www.overleaf.com/learn/how-to/Why_do_I_keep_getting_the_compile_timeout_error_message%3F" />,
+          ]}
+        />
+      </p>
+    </ErrorLogEntry>
+  )
 }
 }
 TimedOutLogEntry.propTypes = {}
 TimedOutLogEntry.propTypes = {}

+ 2 - 3
services/web/frontend/js/features/pdf-preview/util/compiler.js

@@ -98,10 +98,9 @@ export default class DocumentCompiler {
         // use incremental compile for all users but revert to a full compile
         // use incremental compile for all users but revert to a full compile
         // if there was previously a server error
         // if there was previously a server error
         incrementalCompilesEnabled: !this.error,
         incrementalCompilesEnabled: !this.error,
+        stopOnFirstError: options.stopOnFirstError,
       }
       }
-      if (getMeta('ol-showStopOnFirstError')) {
-        body.stopOnFirstError = options.stopOnFirstError
-      }
+
       const data = await postJSON(
       const data = await postJSON(
         `/project/${this.projectId}/compile?${params}`,
         `/project/${this.projectId}/compile?${params}`,
         { body, signal: this.signal }
         { body, signal: this.signal }

+ 25 - 45
services/web/frontend/js/features/preview/components/preview-logs-pane-max-entries.js

@@ -4,14 +4,12 @@ import { Trans, useTranslation } from 'react-i18next'
 import { Button } from 'react-bootstrap'
 import { Button } from 'react-bootstrap'
 import PreviewLogEntryHeader from './preview-log-entry-header'
 import PreviewLogEntryHeader from './preview-log-entry-header'
 import Icon from '../../../shared/components/icon'
 import Icon from '../../../shared/components/icon'
-import getMeta from '../../../utils/meta'
 import { useDetachCompileContext as useCompileContext } from '../../../shared/context/detach-compile-context'
 import { useDetachCompileContext as useCompileContext } from '../../../shared/context/detach-compile-context'
 import { useStopOnFirstError } from '../../../shared/hooks/use-stop-on-first-error'
 import { useStopOnFirstError } from '../../../shared/hooks/use-stop-on-first-error'
 import StopOnFirstErrorBadge from '../../../shared/components/stop-on-first-error-badge'
 import StopOnFirstErrorBadge from '../../../shared/components/stop-on-first-error-badge'
 
 
 function PreviewLogsPaneMaxEntries({ totalEntries, entriesShown, hasErrors }) {
 function PreviewLogsPaneMaxEntries({ totalEntries, entriesShown, hasErrors }) {
   const { t } = useTranslation()
   const { t } = useTranslation()
-  const showStopOnFirstError = getMeta('ol-showStopOnFirstError')
   const { startCompile, stoppedOnFirstError, setAnimateCompileDropdownArrow } =
   const { startCompile, stoppedOnFirstError, setAnimateCompileDropdownArrow } =
     useCompileContext()
     useCompileContext()
   const { enableStopOnFirstError } = useStopOnFirstError({
   const { enableStopOnFirstError } = useStopOnFirstError({
@@ -34,57 +32,39 @@ function PreviewLogsPaneMaxEntries({ totalEntries, entriesShown, hasErrors }) {
       <PreviewLogEntryHeader level="raw" headerTitle={title} />
       <PreviewLogEntryHeader level="raw" headerTitle={title} />
       <div className="log-entry-content">
       <div className="log-entry-content">
         <div className="log-entry-formatted-content">
         <div className="log-entry-formatted-content">
-          {showStopOnFirstError ? (
-            hasErrors && !stoppedOnFirstError ? (
-              <>
-                <p>
-                  <Icon type="lightbulb-o" />
-                  &nbsp;
-                  <strong>{t('tip')}: </strong>
-                  <Trans
-                    i18nKey="log_entry_maximum_entries_enable_stop_on_first_error"
-                    components={{
-                      button: (
-                        <Button
-                          bsSize="xs"
-                          bsStyle="info"
-                          onClick={handleEnableStopOnFirstErrorClick}
-                        />
-                      ),
-                      'learn-more-link': (
-                        // eslint-disable-next-line jsx-a11y/anchor-has-content
-                        <a href="https://www.overleaf.com/learn/latex/Questions/Tips_and_Tricks_for_Troubleshooting_LaTeX" />
-                      ),
-                    }}
-                  />{' '}
-                  <StopOnFirstErrorBadge placement="bottom" />
-                </p>
-                <p>{t('log_entry_maximum_entries_see_full_logs')}</p>
-              </>
-            ) : (
+          {hasErrors && !stoppedOnFirstError ? (
+            <>
               <p>
               <p>
                 <Icon type="lightbulb-o" />
                 <Icon type="lightbulb-o" />
                 &nbsp;
                 &nbsp;
                 <strong>{t('tip')}: </strong>
                 <strong>{t('tip')}: </strong>
-                {t('log_entry_maximum_entries_see_full_logs')}
+                <Trans
+                  i18nKey="log_entry_maximum_entries_enable_stop_on_first_error"
+                  components={{
+                    button: (
+                      <Button
+                        bsSize="xs"
+                        bsStyle="info"
+                        onClick={handleEnableStopOnFirstErrorClick}
+                      />
+                    ),
+                    'learn-more-link': (
+                      // eslint-disable-next-line jsx-a11y/anchor-has-content
+                      <a href="https://www.overleaf.com/learn/latex/Questions/Tips_and_Tricks_for_Troubleshooting_LaTeX" />
+                    ),
+                  }}
+                />{' '}
+                <StopOnFirstErrorBadge placement="bottom" />
               </p>
               </p>
-            )
+              <p>{t('log_entry_maximum_entries_see_full_logs')}</p>
+            </>
           ) : (
           ) : (
-            <>
+            <p>
               <Icon type="lightbulb-o" />
               <Icon type="lightbulb-o" />
               &nbsp;
               &nbsp;
-              {hasErrors ? (
-                <Trans
-                  i18nKey="log_entry_maximum_entries_message"
-                  components={[<b />, <p />]} // eslint-disable-line react/jsx-key
-                />
-              ) : (
-                <Trans
-                  i18nKey="log_entry_maximum_entries_message_no_errors"
-                  components={[<b />]} // eslint-disable-line react/jsx-key
-                />
-              )}
-            </>
+              <strong>{t('tip')}: </strong>
+              {t('log_entry_maximum_entries_see_full_logs')}
+            </p>
           )}
           )}
         </div>
         </div>
       </div>
       </div>

+ 0 - 3
services/web/locales/en.json

@@ -41,8 +41,6 @@
   "log_entry_description": "Log entry with level: __level__",
   "log_entry_description": "Log entry with level: __level__",
   "log_entry_maximum_entries": "Maximum log entries limit hit",
   "log_entry_maximum_entries": "Maximum log entries limit hit",
   "log_entry_maximum_entries_title": "__total__ log messages total. Showing the first __displayed__",
   "log_entry_maximum_entries_title": "__total__ log messages total. Showing the first __displayed__",
-  "log_entry_maximum_entries_message": "<0>Tip</0>: Try to fix the first error and recompile. Often one error causes many later error messages.<1>If you need to see the full logs, you can still download them or view the raw logs below.</1>",
-  "log_entry_maximum_entries_message_no_errors": "<0>Tip</0>: If you need to see the full logs, you can still download them or view the raw logs below.",
   "log_entry_maximum_entries_enable_stop_on_first_error": "Try to fix the first error and recompile. Often one error causes many later error messages. You can <button>Enable “Stop on first error”</button> to focus on fixing errors. We recommend fixing errors as soon as possible; letting them accumulate may lead to hard-to-debug and fatal errors. <learn-more-link>Learn more</learn-more-link>",
   "log_entry_maximum_entries_enable_stop_on_first_error": "Try to fix the first error and recompile. Often one error causes many later error messages. You can <button>Enable “Stop on first error”</button> to focus on fixing errors. We recommend fixing errors as soon as possible; letting them accumulate may lead to hard-to-debug and fatal errors. <learn-more-link>Learn more</learn-more-link>",
   "log_entry_maximum_entries_see_full_logs": "If you need to see the full logs, you can still download them or view the raw logs below.",
   "log_entry_maximum_entries_see_full_logs": "If you need to see the full logs, you can still download them or view the raw logs below.",
   "tip": "Tip",
   "tip": "Tip",
@@ -1403,7 +1401,6 @@
   "importing_and_merging_changes_in_github": "Importing and merging changes in GitHub",
   "importing_and_merging_changes_in_github": "Importing and merging changes in GitHub",
   "upgrade_for_faster_compiles": "Upgrade for faster compiles and to increase your timeout limit",
   "upgrade_for_faster_compiles": "Upgrade for faster compiles and to increase your timeout limit",
   "free_accounts_have_timeout_upgrade_to_increase": "Free accounts have a one minute timeout, whereas upgraded accounts have a timeout of four minutes.",
   "free_accounts_have_timeout_upgrade_to_increase": "Free accounts have a one minute timeout, whereas upgraded accounts have a timeout of four minutes.",
-  "learn_how_to_make_documents_compile_quickly": "Learn how to fix compile timeouts",
   "zh-CN": "Chinese",
   "zh-CN": "Chinese",
   "cn": "Chinese (Simplified)",
   "cn": "Chinese (Simplified)",
   "sync_to_github": "Sync to GitHub",
   "sync_to_github": "Sync to GitHub",