From ee3e28e12620e66236d804691264fb40eed031a6 Mon Sep 17 00:00:00 2001 From: Martynas Bagdonas Date: Wed, 9 Feb 2022 16:49:16 +0200 Subject: [PATCH] Changes to how author name is passed to pdf-reader and pdf-worker --- chrome/content/zotero/xpcom/annotations.js | 8 +++++--- chrome/content/zotero/xpcom/pdfWorker/manager.js | 5 ++++- pdf-reader | 2 +- pdf-worker | 2 +- 4 files changed, 11 insertions(+), 6 deletions(-) diff --git a/chrome/content/zotero/xpcom/annotations.js b/chrome/content/zotero/xpcom/annotations.js index 83dfd7e2c2..438dc71a9a 100644 --- a/chrome/content/zotero/xpcom/annotations.js +++ b/chrome/content/zotero/xpcom/annotations.js @@ -121,12 +121,14 @@ Zotero.Annotations = new function () { var isGroup = item.library.libraryType == 'group'; if (item.annotationAuthorName) { o.authorName = item.annotationAuthorName; + if (isGroup) { + o.lastModifiedByUser = Zotero.Users.getName(item.lastModifiedByUserID) + || Zotero.Users.getName(item.createdByUserID); + } } else if (!o.isExternal && isGroup) { o.authorName = Zotero.Users.getName(item.createdByUserID); - } - if (o.authorName && isGroup) { - o.lastModifiedByUser = Zotero.Users.getName(item.lastModifiedByUserID) + o.isAuthorNameAuthoritative = true; } o.readOnly = o.isExternal || !isAuthor; if (o.type == 'highlight') { diff --git a/chrome/content/zotero/xpcom/pdfWorker/manager.js b/chrome/content/zotero/xpcom/pdfWorker/manager.js index de85c14b65..406f78daed 100644 --- a/chrome/content/zotero/xpcom/pdfWorker/manager.js +++ b/chrome/content/zotero/xpcom/pdfWorker/manager.js @@ -157,7 +157,10 @@ class PDFWorker { annotations.push({ id: item.key, type: item.annotationType, - authorName: Zotero.Users.getName(item.createdByUserID) || Zotero.Users.getCurrentUsername() || '', + // Author name is only set when the PDF file is 1) in a group library, + // 2) was moved back to a private library or 3) was imported from a PDF file + // that was previously exported in 1) or 2) case + authorName: item.annotationAuthorName || Zotero.Users.getName(item.createdByUserID) || '', comment: (item.annotationComment || '').replace(/<\/?(i|b|sub|sup)>/g, ''), color: item.annotationColor, position: JSON.parse(item.annotationPosition), diff --git a/pdf-reader b/pdf-reader index 2a48fc038c..4f14537a31 160000 --- a/pdf-reader +++ b/pdf-reader @@ -1 +1 @@ -Subproject commit 2a48fc038c551e58d7574daabcab3d3a818ec846 +Subproject commit 4f14537a31ed66152d99a949d554b8e7ef7f1260 diff --git a/pdf-worker b/pdf-worker index c785b5148a..fedade7ffd 160000 --- a/pdf-worker +++ b/pdf-worker @@ -1 +1 @@ -Subproject commit c785b5148a72cfd67e7dd95b1342f18e4bb60cdd +Subproject commit fedade7ffde74e281d11205f02acfac2c1c1376e