Kaynağa Gözat

Merge pull request #7833 from overleaf/ta-settings-fixes-5

[SettingsPage] Small Fixes 5

GitOrigin-RevId: a0d02be246ff5128fa382bd7a9723f01377855b9
Timothée Alby 4 yıl önce
ebeveyn
işleme
426aaa8b4b

+ 1 - 2
services/web/frontend/extracted-translations.json

@@ -99,7 +99,6 @@
   "dropbox_sync_description": "",
   "dropbox_sync_description": "",
   "dropbox_sync_in": "",
   "dropbox_sync_in": "",
   "dropbox_sync_out": "",
   "dropbox_sync_out": "",
-  "dropbox_sync_status_error": "",
   "dropbox_synced": "",
   "dropbox_synced": "",
   "duplicate_file": "",
   "duplicate_file": "",
   "easily_manage_your_project_files_everywhere": "",
   "easily_manage_your_project_files_everywhere": "",
@@ -334,6 +333,7 @@
   "project_ownership_transfer_confirmation_1": "",
   "project_ownership_transfer_confirmation_1": "",
   "project_ownership_transfer_confirmation_2": "",
   "project_ownership_transfer_confirmation_2": "",
   "project_synced_with_git_repo_at": "",
   "project_synced_with_git_repo_at": "",
+  "project_synchronisation": "",
   "project_too_large": "",
   "project_too_large": "",
   "project_too_large_please_reduce": "",
   "project_too_large_please_reduce": "",
   "project_too_much_editable_text": "",
   "project_too_much_editable_text": "",
@@ -421,7 +421,6 @@
   "submit_title": "",
   "submit_title": "",
   "subscription_admins_cannot_be_deleted": "",
   "subscription_admins_cannot_be_deleted": "",
   "sure_you_want_to_delete": "",
   "sure_you_want_to_delete": "",
-  "sync_dropbox_github": "",
   "sync_project_to_github_explanation": "",
   "sync_project_to_github_explanation": "",
   "sync_to_dropbox": "",
   "sync_to_dropbox": "",
   "sync_to_github": "",
   "sync_to_github": "",

+ 6 - 0
services/web/frontend/js/features/settings/components/emails/add-email/input.tsx

@@ -133,6 +133,12 @@ function Input({ onChange }: InputProps) {
     [suggestion]
     [suggestion]
   )
   )
 
 
+  useEffect(() => {
+    if (suggestion && !suggestion.startsWith(inputValue)) {
+      setSuggestion(null)
+    }
+  }, [suggestion, inputValue])
+
   return (
   return (
     <div className="input-suggestions">
     <div className="input-suggestions">
       <div className="form-control input-suggestions-shadow">
       <div className="form-control input-suggestions-shadow">

+ 1 - 1
services/web/frontend/js/features/settings/components/linking-section.tsx

@@ -43,7 +43,7 @@ function LinkingSection() {
       {hasIntegrationLinkingSection ? (
       {hasIntegrationLinkingSection ? (
         <>
         <>
           <h3 id="project-sync" className="text-capitalize">
           <h3 id="project-sync" className="text-capitalize">
-            {t('sync_dropbox_github')}
+            {t('project_synchronisation')}
           </h3>
           </h3>
           {projectSyncSuccessMessage ? (
           {projectSyncSuccessMessage ? (
             <Alert bsStyle="success">{projectSyncSuccessMessage}</Alert>
             <Alert bsStyle="success">{projectSyncSuccessMessage}</Alert>

+ 1 - 1
services/web/frontend/js/features/settings/components/linking/integration-widget.tsx

@@ -123,7 +123,7 @@ function ActionButton({
     return (
     return (
       <a
       <a
         href={linkPath}
         href={linkPath}
-        className="btn btn-primary text-capitalize"
+        className="btn btn-info text-capitalize"
         disabled={disabled}
         disabled={disabled}
       >
       >
         {t('link')}
         {t('link')}

+ 1 - 1
services/web/frontend/js/features/settings/components/linking/sso-widget.tsx

@@ -123,7 +123,7 @@ function ActionButton({
     )
     )
   } else {
   } else {
     return (
     return (
-      <a href={linkPath} className="btn btn-primary text-capitalize">
+      <a href={linkPath} className="btn btn-info text-capitalize">
         {t('link')}
         {t('link')}
       </a>
       </a>
     )
     )

+ 1 - 1
services/web/frontend/js/infrastructure/fetch-json.js

@@ -112,7 +112,7 @@ export class FetchError extends OError {
       case 429:
       case 429:
         return 'Too many attempts. Please wait for a while and try again.'
         return 'Too many attempts. Please wait for a while and try again.'
       default:
       default:
-        return 'Something went wrong talking to the server :(. Please try again.'
+        return 'Something went wrong. Please try again.'
     }
     }
   }
   }
 }
 }

+ 5 - 5
services/web/locales/en.json

@@ -108,7 +108,6 @@
   "dropbox_sync_out": "Sending updates to Dropbox",
   "dropbox_sync_out": "Sending updates to Dropbox",
   "dropbox_sync_both": "Sending and receiving updates",
   "dropbox_sync_both": "Sending and receiving updates",
   "dropbox_synced": "Overleaf and Dropbox have processed all updates. Note that your local Dropbox might still be synchronizing",
   "dropbox_synced": "Overleaf and Dropbox have processed all updates. Note that your local Dropbox might still be synchronizing",
-  "dropbox_sync_status_error": "An error has occurred with the Dropbox Integration",
   "dropbox_duplicate_names_error": "Your Dropbox account can not be linked, because you have more than one project with the same name: ",
   "dropbox_duplicate_names_error": "Your Dropbox account can not be linked, because you have more than one project with the same name: ",
   "requesting_password_reset": "Requesting password reset",
   "requesting_password_reset": "Requesting password reset",
   "tex_live_version": "TeX Live version",
   "tex_live_version": "TeX Live version",
@@ -255,7 +254,7 @@
   "find_out_more_nt": "Find out more.",
   "find_out_more_nt": "Find out more.",
   "register_error": "Registration error",
   "register_error": "Registration error",
   "login_error": "Login error",
   "login_error": "Login error",
-  "sso_link_error": "Error linking SSO account",
+  "sso_link_error": "Error linking account",
   "more_info": "More Info",
   "more_info": "More Info",
   "synctex_failed": "Couldn’t find the corresponding source file",
   "synctex_failed": "Couldn’t find the corresponding source file",
   "linked_collabratec_description": "Use Collabratec to manage your __appName__ projects.",
   "linked_collabratec_description": "Use Collabratec to manage your __appName__ projects.",
@@ -521,6 +520,7 @@
   "limited_time_discount": "Limited-time discount!",
   "limited_time_discount": "Limited-time discount!",
   "all_premium_features": "All premium features",
   "all_premium_features": "All premium features",
   "sync_dropbox_github": "Sync with Dropbox and GitHub",
   "sync_dropbox_github": "Sync with Dropbox and GitHub",
+  "project_synchronisation": "Project Synchronisation",
   "demonstrating_git_integration": "Demonstrating Git integration",
   "demonstrating_git_integration": "Demonstrating Git integration",
   "collaborate_online_and_offline": "Collaborate online and offline, using your own workflow",
   "collaborate_online_and_offline": "Collaborate online and offline, using your own workflow",
   "get_collaborative_benefits": "Get the collaborative benefits from __appName__, even if you prefer to work offline",
   "get_collaborative_benefits": "Get the collaborative benefits from __appName__, even if you prefer to work offline",
@@ -636,7 +636,7 @@
   "tracked_change_deleted": "Deleted",
   "tracked_change_deleted": "Deleted",
   "show_all": "show all",
   "show_all": "show all",
   "show_less": "show less",
   "show_less": "show less",
-  "dropbox_sync_error": "Sorry, there was an error talking to our Dropbox service. Please try again in a few moments.",
+  "dropbox_sync_error": "Sorry, there was a problem checking our Dropbox service. Please try again in a few moments.",
   "send": "Send",
   "send": "Send",
   "sending": "Sending",
   "sending": "Sending",
   "invalid_password": "Invalid Password",
   "invalid_password": "Invalid Password",
@@ -1474,7 +1474,7 @@
   "github_account_successfully_linked": "GitHub Account Successfully Linked!",
   "github_account_successfully_linked": "GitHub Account Successfully Linked!",
   "github_successfully_linked_description": "Thanks, we’ve successfully linked your GitHub account to __appName__. You can now export your __appName__ projects to GitHub, or import projects from your GitHub repositories.",
   "github_successfully_linked_description": "Thanks, we’ve successfully linked your GitHub account to __appName__. You can now export your __appName__ projects to GitHub, or import projects from your GitHub repositories.",
   "import_from_github": "Import from GitHub",
   "import_from_github": "Import from GitHub",
-  "github_sync_error": "Sorry, there was an error talking to our GitHub service. Please try again in a few moments.",
+  "github_sync_error": "Sorry, there was a problem checking our GitHub service. Please try again in a few moments.",
   "loading_github_repositories": "Loading your GitHub repositories",
   "loading_github_repositories": "Loading your GitHub repositories",
   "select_github_repository": "Select a GitHub repository to import into __appName__.",
   "select_github_repository": "Select a GitHub repository to import into __appName__.",
   "import_to_sharelatex": "Import to __appName__",
   "import_to_sharelatex": "Import to __appName__",
@@ -1546,7 +1546,7 @@
   "invalid_request": "Invalid Request. Please correct the data and try again.",
   "invalid_request": "Invalid Request. Please correct the data and try again.",
   "session_error": "Session error. Please check you have cookies enabled. If the problem persists, try clearing your cache and cookies.",
   "session_error": "Session error. Please check you have cookies enabled. If the problem persists, try clearing your cache and cookies.",
   "too_many_attempts": "Too many attempts. Please wait for a while and try again.",
   "too_many_attempts": "Too many attempts. Please wait for a while and try again.",
-  "something_went_wrong_server": "Something went wrong talking to the server :(. Please try again.",
+  "something_went_wrong_server": "Something went wrong. Please try again.",
   "file_name": "File Name",
   "file_name": "File Name",
   "from_another_project": "From Another Project",
   "from_another_project": "From Another Project",
   "from_external_url": "From External URL",
   "from_external_url": "From External URL",

+ 1 - 3
services/web/test/frontend/features/settings/components/account-info-section.test.tsx

@@ -107,9 +107,7 @@ describe('<AccountInfoSection />', function () {
         name: 'Update',
         name: 'Update',
       })
       })
     )
     )
-    await screen.findByText(
-      'Something went wrong talking to the server :(. Please try again.'
-    )
+    await screen.findByText('Something went wrong. Please try again.')
   })
   })
 
 
   it('shows invalid error', async function () {
   it('shows invalid error', async function () {

+ 12 - 0
services/web/test/frontend/features/settings/components/emails/add-email-input.test.tsx

@@ -253,4 +253,16 @@ describe('<AddEmailInput/>', function () {
       expect(fetchMock.called()).to.be.true // ensures `domainCache` hasn't been hit
       expect(fetchMock.called()).to.be.true // ensures `domainCache` hasn't been hit
     })
     })
   })
   })
+
+  describe('when the request to fetch institution is not matching input', function () {
+    it('should clear suggestion', async function () {
+      fetchMock.get('express:/institutions/domains', testInstitutionData)
+      render(<Input {...defaultProps} onChange={sinon.stub()} />)
+      fireEvent.change(screen.getByRole('textbox'), {
+        target: { value: 'user@other' },
+      })
+      await fetchMock.flush(true)
+      expect(screen.queryByText('user@domain.edu')).to.not.exist
+    })
+  })
 })
 })

+ 1 - 1
services/web/test/frontend/features/settings/components/linking-section.test.tsx

@@ -92,7 +92,7 @@ describe('<LinkingSection />', function () {
   it('shows SSO error message', async function () {
   it('shows SSO error message', async function () {
     window.metaAttributesCache.set('ol-ssoErrorMessage', 'You no SSO')
     window.metaAttributesCache.set('ol-ssoErrorMessage', 'You no SSO')
     renderSectionWithProviders()
     renderSectionWithProviders()
-    screen.getByText('Error linking SSO account: You no SSO')
+    screen.getByText('Error linking account: You no SSO')
   })
   })
 
 
   it('does not show providers section when empty', async function () {
   it('does not show providers section when empty', async function () {

+ 1 - 3
services/web/test/frontend/features/settings/components/linking/sso-widget.test.tsx

@@ -120,9 +120,7 @@ describe('<SSOLinkingWidget />', function () {
 
 
     it('should display an error message ', async function () {
     it('should display an error message ', async function () {
       await waitFor(() =>
       await waitFor(() =>
-        screen.getByText(
-          'Something went wrong talking to the server :(. Please try again.'
-        )
+        screen.getByText('Something went wrong. Please try again.')
       )
       )
     })
     })
 
 

+ 1 - 3
services/web/test/frontend/features/settings/components/password-section.test.tsx

@@ -160,9 +160,7 @@ describe('<PasswordSection />', function () {
     fetchMock.post('/user/password/update', 500)
     fetchMock.post('/user/password/update', 500)
     render(<PasswordSection />)
     render(<PasswordSection />)
     submitValidForm()
     submitValidForm()
-    await screen.findByText(
-      'Something went wrong talking to the server :(. Please try again.'
-    )
+    await screen.findByText('Something went wrong. Please try again.')
   })
   })
 
 
   it('shows server error message', async function () {
   it('shows server error message', async function () {