mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-07 20:31:06 -05:00
Improve error message when a collaborator tries to refresh a linked file without access to the project (#8884)
* Improve error message when a collaborator tries to refresh a linked file without access to the project * Move the AccessDeniedError hardcoded error message to translation file * apply prettier * remove period (dot) in test hardcoded string * revert unintended changes GitOrigin-RevId: 50a5bf46428a96e629e9091cc18068f3ee7084e3
This commit is contained in:
parent
22473d3615
commit
574d0eab12
5 changed files with 14 additions and 4 deletions
|
@ -140,7 +140,12 @@ module.exports = LinkedFilesController = {
|
|||
handleError(error, req, res, next) {
|
||||
if (error instanceof AccessDeniedError) {
|
||||
res.status(403)
|
||||
plainTextResponse(res, 'You do not have access to this project')
|
||||
plainTextResponse(
|
||||
res,
|
||||
res.locals.translate(
|
||||
'the_project_that_contains_this_file_is_not_shared_with_you'
|
||||
)
|
||||
)
|
||||
} else if (error instanceof BadDataError) {
|
||||
res.status(400)
|
||||
plainTextResponse(res, 'The submitted data is not valid')
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
{
|
||||
"access_denied": "",
|
||||
"access_your_projects_with_git": "",
|
||||
"account_not_linked_to_dropbox": "",
|
||||
"account_settings": "",
|
||||
|
|
|
@ -138,7 +138,7 @@ export default function FileViewHeader({ file, storeReferencesKeys }) {
|
|||
<div className="row">
|
||||
<br />
|
||||
<div className="alert alert-danger col-md-6 col-md-offset-3">
|
||||
{t('error')}: {refreshError}
|
||||
{t('access_denied')}: {refreshError}
|
||||
{tprLinkedFileRefreshError.map(
|
||||
({ import: { LinkedFileRefreshError }, path }) => (
|
||||
<LinkedFileRefreshError key={path} file={file} />
|
||||
|
|
|
@ -1793,5 +1793,7 @@
|
|||
"would_you_like_to_see_a_university_subscription": "Would you like to see a university-wide __appName__ subscription at your university?",
|
||||
"student_and_faculty_support_make_difference": "Student and faculty support make a difference! We can share this information with our contacts at your university when discussing an Overleaf institutional account.",
|
||||
"show_your_support": "Show your support",
|
||||
"approaching_compile_timeout_limit_upgrade_for_more_compile_time": "You are approaching your compile timeout limit. Upgrade to <strong>Overleaf Premium</strong> for <0>4x more</0> compile time."
|
||||
"approaching_compile_timeout_limit_upgrade_for_more_compile_time": "You are approaching your compile timeout limit. Upgrade to <strong>Overleaf Premium</strong> for <0>4x more</0> compile time.",
|
||||
"access_denied": "Access Denied",
|
||||
"the_project_that_contains_this_file_is_not_shared_with_you": "The project that contains this file is not shared with you"
|
||||
}
|
||||
|
|
|
@ -156,7 +156,9 @@ describe('LinkedFiles', function () {
|
|||
},
|
||||
}))
|
||||
expect(response.statusCode).to.equal(403)
|
||||
expect(body).to.equal('You do not have access to this project')
|
||||
expect(body).to.equal(
|
||||
'The project that contains this file is not shared with you'
|
||||
)
|
||||
})
|
||||
|
||||
it('should generate a proper error message when the source file has been deleted', async function () {
|
||||
|
|
Loading…
Reference in a new issue