Mendeley import: Add "★" tag for favourite items (#2122)

Also ensure that "★" tag is added to an existing item on re-import
where appropriate.
This commit is contained in:
Tom Najdek 2021-07-13 12:28:05 +02:00 committed by GitHub
parent d2db842938
commit ec2ad91938
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 7 additions and 1 deletions

View file

@ -1042,7 +1042,7 @@ Zotero_Import_Mendeley.prototype._documentToAPIJSON = async function (map, docum
}
parent.tags = [];
// Add star tag for favorites
if (documentRow.favourite == 'true') {
if (documentRow.favourite === 'true' || documentRow.favourite === true) {
parent.tags.push('\u2605');
}
if (tags) {
@ -1240,6 +1240,11 @@ Zotero_Import_Mendeley.prototype._saveItems = async function (libraryID, json) {
if (itemJSON.publicationTitle && !item.getField('publicationTitle')) {
item.setField('publicationTitle', itemJSON.publicationTitle);
}
// Add "★" tag if not present, since it was previously missed in the online importer
if ((itemJSON.tags || []).includes('\u2605') && !item.hasTag('\u2605')) {
item.addTag('\u2605');
}
// Update any child items to point to the existing item's key instead of the
// new generated one

View file

@ -50,6 +50,7 @@ var mendeleyOnlineMappings = {
short_title: 'shortTitle',
source: 'publication',
source_type: 'sourceType',
starred: 'favourite',
tags: false, // tags handled separately
translators: false, // all author types handled separately
user_context: 'userContext',