From 484eb1f1d7fef8e4dbcea7e9f9a089e907f1f1f1 Mon Sep 17 00:00:00 2001 From: Dan Stillman Date: Mon, 13 Jan 2025 02:33:19 -0500 Subject: [PATCH] Fix ids showing instead of creator names for creator autocomplete https://forums.zotero.org/discussion/121089/beta-author-suggestions-broken-only-suggest-numbers-instead-of-names Related Mozilla bugs (though I don't see a change that would be directly responsible for this): https://bugzilla.mozilla.org/show_bug.cgi?id=1886064 https://bugzilla.mozilla.org/show_bug.cgi?id=1910073 --- chrome/content/zotero/elements/itemBox.js | 4 ++-- chrome/content/zotero/zotero-autocomplete.js | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/chrome/content/zotero/elements/itemBox.js b/chrome/content/zotero/elements/itemBox.js index fe4d09d506..8578e543c8 100644 --- a/chrome/content/zotero/elements/itemBox.js +++ b/chrome/content/zotero/elements/itemBox.js @@ -1993,8 +1993,8 @@ var id = false; for (let i = 0; i < controller.matchCount; i++) { - if (controller.getCommentAt(i) == textbox.value) { - id = controller.getLabelAt(i); + if (controller.getValueAt(i) == textbox.value) { + id = controller.getCommentAt(i); break; } } diff --git a/chrome/content/zotero/zotero-autocomplete.js b/chrome/content/zotero/zotero-autocomplete.js index 5b569dfdc3..d556fa57c9 100644 --- a/chrome/content/zotero/zotero-autocomplete.js +++ b/chrome/content/zotero/zotero-autocomplete.js @@ -286,7 +286,7 @@ ZoteroAutoComplete.prototype.startSearch = Zotero.Promise.coroutine(function* (s ZoteroAutoComplete.prototype.updateResult = function (value, id) { Zotero.debug(`Appending autocomplete value '${value}'` + (id ? " (" + id + ")" : '')); // Add to nsIAutoCompleteResult - this._result.appendMatch(value, value, null, null, null, id); + this._result.appendMatch(value, id, null, null, null, value); // Add to our own list this._results.push(value); // Only update the UI every 10 records @@ -311,7 +311,7 @@ ZoteroAutoComplete.prototype.updateResults = function (values, ids, ongoing, res if (!this._results.includes(value)) { let id = ids[i] || null; Zotero.debug("Adding autocomplete value '" + value + "'" + (id ? " (" + id + ")" : "")); - this._result.appendMatch(value, value, null, null, null, id); + this._result.appendMatch(value, id, null, null, null, value); this._results.push(value); } else {