From 426aaa8b4b365c1095dd6b9a016c3e03cbc8960e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timoth=C3=A9e=20Alby?= Date: Mon, 16 May 2022 10:02:50 +0200 Subject: [PATCH] Merge pull request #7833 from overleaf/ta-settings-fixes-5 [SettingsPage] Small Fixes 5 GitOrigin-RevId: a0d02be246ff5128fa382bd7a9723f01377855b9 --- services/web/frontend/extracted-translations.json | 3 +-- .../settings/components/emails/add-email/input.tsx | 6 ++++++ .../features/settings/components/linking-section.tsx | 2 +- .../components/linking/integration-widget.tsx | 2 +- .../settings/components/linking/sso-widget.tsx | 2 +- .../web/frontend/js/infrastructure/fetch-json.js | 2 +- services/web/locales/en.json | 10 +++++----- .../components/account-info-section.test.tsx | 4 +--- .../components/emails/add-email-input.test.tsx | 12 ++++++++++++ .../settings/components/linking-section.test.tsx | 2 +- .../settings/components/linking/sso-widget.test.tsx | 4 +--- .../settings/components/password-section.test.tsx | 4 +--- 12 files changed, 32 insertions(+), 21 deletions(-) diff --git a/services/web/frontend/extracted-translations.json b/services/web/frontend/extracted-translations.json index 2df650977b..c8cd9b40c4 100644 --- a/services/web/frontend/extracted-translations.json +++ b/services/web/frontend/extracted-translations.json @@ -99,7 +99,6 @@ "dropbox_sync_description": "", "dropbox_sync_in": "", "dropbox_sync_out": "", - "dropbox_sync_status_error": "", "dropbox_synced": "", "duplicate_file": "", "easily_manage_your_project_files_everywhere": "", @@ -334,6 +333,7 @@ "project_ownership_transfer_confirmation_1": "", "project_ownership_transfer_confirmation_2": "", "project_synced_with_git_repo_at": "", + "project_synchronisation": "", "project_too_large": "", "project_too_large_please_reduce": "", "project_too_much_editable_text": "", @@ -421,7 +421,6 @@ "submit_title": "", "subscription_admins_cannot_be_deleted": "", "sure_you_want_to_delete": "", - "sync_dropbox_github": "", "sync_project_to_github_explanation": "", "sync_to_dropbox": "", "sync_to_github": "", diff --git a/services/web/frontend/js/features/settings/components/emails/add-email/input.tsx b/services/web/frontend/js/features/settings/components/emails/add-email/input.tsx index 07a6ced61e..5eeab6af01 100644 --- a/services/web/frontend/js/features/settings/components/emails/add-email/input.tsx +++ b/services/web/frontend/js/features/settings/components/emails/add-email/input.tsx @@ -133,6 +133,12 @@ function Input({ onChange }: InputProps) { [suggestion] ) + useEffect(() => { + if (suggestion && !suggestion.startsWith(inputValue)) { + setSuggestion(null) + } + }, [suggestion, inputValue]) + return (
diff --git a/services/web/frontend/js/features/settings/components/linking-section.tsx b/services/web/frontend/js/features/settings/components/linking-section.tsx index 435b30d766..bf0daab709 100644 --- a/services/web/frontend/js/features/settings/components/linking-section.tsx +++ b/services/web/frontend/js/features/settings/components/linking-section.tsx @@ -43,7 +43,7 @@ function LinkingSection() { {hasIntegrationLinkingSection ? ( <>

- {t('sync_dropbox_github')} + {t('project_synchronisation')}

{projectSyncSuccessMessage ? ( {projectSyncSuccessMessage} diff --git a/services/web/frontend/js/features/settings/components/linking/integration-widget.tsx b/services/web/frontend/js/features/settings/components/linking/integration-widget.tsx index 5913a54e2b..a900b4ac26 100644 --- a/services/web/frontend/js/features/settings/components/linking/integration-widget.tsx +++ b/services/web/frontend/js/features/settings/components/linking/integration-widget.tsx @@ -123,7 +123,7 @@ function ActionButton({ return ( {t('link')} diff --git a/services/web/frontend/js/features/settings/components/linking/sso-widget.tsx b/services/web/frontend/js/features/settings/components/linking/sso-widget.tsx index db5e55d057..0424fe36df 100644 --- a/services/web/frontend/js/features/settings/components/linking/sso-widget.tsx +++ b/services/web/frontend/js/features/settings/components/linking/sso-widget.tsx @@ -123,7 +123,7 @@ function ActionButton({ ) } else { return ( - + {t('link')} ) diff --git a/services/web/frontend/js/infrastructure/fetch-json.js b/services/web/frontend/js/infrastructure/fetch-json.js index f0e4c66949..2fc8a380c4 100644 --- a/services/web/frontend/js/infrastructure/fetch-json.js +++ b/services/web/frontend/js/infrastructure/fetch-json.js @@ -112,7 +112,7 @@ export class FetchError extends OError { case 429: return 'Too many attempts. Please wait for a while and try again.' default: - return 'Something went wrong talking to the server :(. Please try again.' + return 'Something went wrong. Please try again.' } } } diff --git a/services/web/locales/en.json b/services/web/locales/en.json index 867632030d..0c08332073 100644 --- a/services/web/locales/en.json +++ b/services/web/locales/en.json @@ -108,7 +108,6 @@ "dropbox_sync_out": "Sending updates to Dropbox", "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_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: ", "requesting_password_reset": "Requesting password reset", "tex_live_version": "TeX Live version", @@ -255,7 +254,7 @@ "find_out_more_nt": "Find out more.", "register_error": "Registration error", "login_error": "Login error", - "sso_link_error": "Error linking SSO account", + "sso_link_error": "Error linking account", "more_info": "More Info", "synctex_failed": "Couldn’t find the corresponding source file", "linked_collabratec_description": "Use Collabratec to manage your __appName__ projects.", @@ -521,6 +520,7 @@ "limited_time_discount": "Limited-time discount!", "all_premium_features": "All premium features", "sync_dropbox_github": "Sync with Dropbox and GitHub", + "project_synchronisation": "Project Synchronisation", "demonstrating_git_integration": "Demonstrating Git integration", "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", @@ -636,7 +636,7 @@ "tracked_change_deleted": "Deleted", "show_all": "show all", "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", "sending": "Sending", "invalid_password": "Invalid Password", @@ -1474,7 +1474,7 @@ "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.", "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", "select_github_repository": "Select a GitHub repository to import into __appName__.", "import_to_sharelatex": "Import to __appName__", @@ -1546,7 +1546,7 @@ "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.", "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", "from_another_project": "From Another Project", "from_external_url": "From External URL", diff --git a/services/web/test/frontend/features/settings/components/account-info-section.test.tsx b/services/web/test/frontend/features/settings/components/account-info-section.test.tsx index eb3a2be00a..fa570c1c86 100644 --- a/services/web/test/frontend/features/settings/components/account-info-section.test.tsx +++ b/services/web/test/frontend/features/settings/components/account-info-section.test.tsx @@ -107,9 +107,7 @@ describe('', function () { 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 () { diff --git a/services/web/test/frontend/features/settings/components/emails/add-email-input.test.tsx b/services/web/test/frontend/features/settings/components/emails/add-email-input.test.tsx index 2dc8a202fe..b6515e3251 100644 --- a/services/web/test/frontend/features/settings/components/emails/add-email-input.test.tsx +++ b/services/web/test/frontend/features/settings/components/emails/add-email-input.test.tsx @@ -253,4 +253,16 @@ describe('', function () { 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() + fireEvent.change(screen.getByRole('textbox'), { + target: { value: 'user@other' }, + }) + await fetchMock.flush(true) + expect(screen.queryByText('user@domain.edu')).to.not.exist + }) + }) }) diff --git a/services/web/test/frontend/features/settings/components/linking-section.test.tsx b/services/web/test/frontend/features/settings/components/linking-section.test.tsx index b70f19fa15..3521d5659c 100644 --- a/services/web/test/frontend/features/settings/components/linking-section.test.tsx +++ b/services/web/test/frontend/features/settings/components/linking-section.test.tsx @@ -92,7 +92,7 @@ describe('', function () { it('shows SSO error message', async function () { window.metaAttributesCache.set('ol-ssoErrorMessage', 'You no SSO') 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 () { diff --git a/services/web/test/frontend/features/settings/components/linking/sso-widget.test.tsx b/services/web/test/frontend/features/settings/components/linking/sso-widget.test.tsx index e32bf81ec8..f0f8368da0 100644 --- a/services/web/test/frontend/features/settings/components/linking/sso-widget.test.tsx +++ b/services/web/test/frontend/features/settings/components/linking/sso-widget.test.tsx @@ -120,9 +120,7 @@ describe('', function () { it('should display an error message ', async function () { await waitFor(() => - screen.getByText( - 'Something went wrong talking to the server :(. Please try again.' - ) + screen.getByText('Something went wrong. Please try again.') ) }) diff --git a/services/web/test/frontend/features/settings/components/password-section.test.tsx b/services/web/test/frontend/features/settings/components/password-section.test.tsx index a193d4f3b0..10a229cb84 100644 --- a/services/web/test/frontend/features/settings/components/password-section.test.tsx +++ b/services/web/test/frontend/features/settings/components/password-section.test.tsx @@ -160,9 +160,7 @@ describe('', function () { fetchMock.post('/user/password/update', 500) render() 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 () {