From e80615eab881f7b9ef3c2cf03a6f441d96775e95 Mon Sep 17 00:00:00 2001 From: Abe Jellinek Date: Tue, 22 Apr 2025 12:23:31 -0400 Subject: [PATCH] Scaffold: Don't show deleted line for base-mapped title field And remove dead code. --- .../content/scaffold/scaffoldItemPreview.js | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/chrome/content/scaffold/scaffoldItemPreview.js b/chrome/content/scaffold/scaffoldItemPreview.js index 07df3689a0..1fc0c8ae9f 100644 --- a/chrome/content/scaffold/scaffoldItemPreview.js +++ b/chrome/content/scaffold/scaffoldItemPreview.js @@ -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];