Add support for groups when importing references from Zotero (#6204)

* Add Zotero groups support to third-party-references
* Return 400 response with { relink: true } if remote response was 403
* Handle Zotero groups in tpr-webmodule
* Handle Zotero groups in the frontend
* Handle JSON OAuth token error response from Mendeley API

GitOrigin-RevId: 8011d71a5596f7671aca16a228f9ef40be4a02d0
This commit is contained in:
Alf Eaton 2022-05-11 12:32:21 +01:00 committed by Copybot
parent 11b3e7b6c8
commit 6025d3571c
4 changed files with 24 additions and 2 deletions

View file

@ -190,8 +190,12 @@ module.exports = LinkedFilesController = {
res.status(400)
plainTextResponse(res, 'This feature is not enabled on your account')
} else if (error instanceof RemoteServiceError) {
if (error.info?.statusCode === 403) {
res.status(400).json({ relink: true })
} else {
res.status(502)
plainTextResponse(res, 'The remote service produced an error')
}
} else if (error instanceof FileCannotRefreshError) {
res.status(400)
plainTextResponse(res, 'This file cannot be refreshed')

View file

@ -253,6 +253,7 @@
"math_inline": "",
"maximum_files_uploaded_together": "",
"mendeley_groups_loading_error": "",
"mendeley_groups_relink": "",
"mendeley_integration": "",
"mendeley_is_premium": "",
"mendeley_reference_loading_error": "",
@ -358,6 +359,7 @@
"refresh_page_after_linking_dropbox": "",
"refresh_page_after_starting_free_trial": "",
"refreshing": "",
"relink_your_account": "",
"remote_service_error": "",
"remove": "",
"remove_collaborator": "",
@ -486,6 +488,7 @@
"work_with_non_overleaf_users": "",
"your_message": "",
"zotero_groups_loading_error": "",
"zotero_groups_relink": "",
"zotero_integration": "",
"zotero_is_premium": "",
"zotero_reference_loading_error": "",

View file

@ -65,6 +65,18 @@ export const mockCreateFileModalFetch = fetchMock =>
},
],
})
.get('path:/zotero/groups', {
groups: [
{
id: 'group-1',
name: 'Group One',
},
{
id: 'group-2',
name: 'Group Two',
},
],
})
.get('express:/project/:projectId/entities', {
entities: [
{

View file

@ -750,6 +750,7 @@
"mendeley_reference_loading_success": "Loaded references from Mendeley",
"mendeley_reference_loading_error": "Error, could not load references from Mendeley",
"mendeley_groups_loading_error": "There was an error loading groups from Mendeley",
"mendeley_groups_relink": "There was an error accessing your Mendeley data. This was likely caused by lack of permissions. Please re-link your account and try again.",
"zotero_integration": "Zotero Integration",
"zotero_sync_description": "With Zotero integration you can import your references from Zotero into your __appName__ projects.",
"zotero_is_premium": "Zotero integration is a premium feature",
@ -759,6 +760,8 @@
"zotero_reference_loading_success": "Loaded references from Zotero",
"zotero_reference_loading_error": "Error, could not load references from Zotero",
"zotero_groups_loading_error": "There was an error loading groups from Zotero",
"zotero_groups_relink": "There was an error accessing your Zotero data. This was likely caused by lack of permissions. Please re-link your account and try again.",
"relink_your_account": "Re-link your account",
"reference_import_button": "Import References to",
"unlink_reference": "Unlink References Provider",
"unlink_warning_reference": "Warning: When you unlink your account from this provider you will not be able to import references into your projects.",