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
This commit is contained in:
Dan Stillman 2025-01-13 02:33:19 -05:00
parent 524660e10b
commit 484eb1f1d7
2 changed files with 4 additions and 4 deletions

View file

@ -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;
}
}

View file

@ -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 {