mirror of
https://github.com/zotero/zotero.git
synced 2026-10-04 02:31:47 +00:00
Scaffold: Don't show deleted line for base-mapped title field
And remove dead code.
This commit is contained in:
parent
1655265189
commit
e80615eab8
1 changed files with 13 additions and 8 deletions
|
|
@ -44,18 +44,22 @@
|
|||
|
||||
set jsonItem(jsonItem) {
|
||||
// Don't pass this any objects you really care about
|
||||
|
||||
// Delete ID (meaningless)
|
||||
delete jsonItem.id;
|
||||
|
||||
// _itemDone() sets 'title' in addition to the item type's mapped
|
||||
// title field for some reason. Delete it so it doesn't show up in the diff.
|
||||
let titleField = Zotero.ItemFields.getName(
|
||||
Zotero.ItemFields.getFieldIDFromTypeAndBase(jsonItem.itemType, 'title')
|
||||
);
|
||||
if (titleField !== 'title' && jsonItem[titleField]) {
|
||||
delete jsonItem.title;
|
||||
}
|
||||
|
||||
if (jsonItem.accessDate === 'CURRENT_TIMESTAMP') {
|
||||
jsonItem.accessDate = Zotero.Date.dateToISO(new Date());
|
||||
}
|
||||
for (let attachment of jsonItem.attachments) {
|
||||
if (attachment.document) {
|
||||
attachment.mimeType = 'text/html';
|
||||
attachment.url = attachment.document.location?.href;
|
||||
delete attachment.document;
|
||||
}
|
||||
delete attachment.complete;
|
||||
}
|
||||
|
||||
this._jsonItem = jsonItem;
|
||||
this.render();
|
||||
|
|
@ -116,6 +120,7 @@
|
|||
delete postCleaning.relations;
|
||||
delete postCleaning.collections;
|
||||
delete postCleaning.uniqueFields;
|
||||
delete postCleaning.uri;
|
||||
for (let [key, value] of Object.entries(postCleaning)) {
|
||||
if (value === null) {
|
||||
delete postCleaning[key];
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue