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

[SettingsPage] Small Fixes 5

GitOrigin-RevId: a0d02be246ff5128fa382bd7a9723f01377855b9
This commit is contained in:
Timothée Alby 2022-05-16 10:02:50 +02:00 committed by Copybot
parent 4b87568e4f
commit 426aaa8b4b
12 changed files with 32 additions and 21 deletions

View file

@ -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": "",

View file

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

View file

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

View file

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

View file

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

View file

@ -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.'
}
}
}

View file

@ -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": "Couldnt 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, weve 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",

View file

@ -107,9 +107,7 @@ describe('<AccountInfoSection />', 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 () {

View file

@ -253,4 +253,16 @@ describe('<AddEmailInput/>', 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(<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
})
})
})

View file

@ -92,7 +92,7 @@ describe('<LinkingSection />', 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 () {

View file

@ -120,9 +120,7 @@ describe('<SSOLinkingWidget />', 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.')
)
})

View file

@ -160,9 +160,7 @@ describe('<PasswordSection />', function () {
fetchMock.post('/user/password/update', 500)
render(<PasswordSection />)
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 () {