From 68519d5713d5aa2091f6ce705d28efeda3e15c62 Mon Sep 17 00:00:00 2001 From: Abe Jellinek <1770299+AbeJellinek@users.noreply.github.com> Date: Tue, 12 May 2026 10:20:27 -0400 Subject: [PATCH] Keep old default behavior (to fix other tests) --- chrome/content/zotero/xpcom/data/dataObject.js | 7 ++++++- chrome/content/zotero/xpcom/data/group.js | 2 +- chrome/content/zotero/xpcom/data/item.js | 6 ------ chrome/content/zotero/xpcom/server/server_localAPI.js | 3 ++- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/chrome/content/zotero/xpcom/data/dataObject.js b/chrome/content/zotero/xpcom/data/dataObject.js index 8844232725..3401fc1ce3 100644 --- a/chrome/content/zotero/xpcom/data/dataObject.js +++ b/chrome/content/zotero/xpcom/data/dataObject.js @@ -1382,10 +1382,15 @@ Zotero.DataObject.prototype._finalizeErase = async function (env) { Zotero.DataObject.prototype.toResponseJSON = function (options = {}) { + // Default to showing synced properties, since that's what the API does, and this function + // is generally used to emulate the API + options.syncedStorageProperties ??= true; + options.syncedVersionProperty ??= true; + let uri = Zotero.URI.getObjectURI(this); var json = { key: this.key, - version: this.clientVersion, + version: options.syncedVersionProperty ? this.version : this.clientVersion, library: this.library.toResponseJSON({ ...options, includeGroupDetails: false }), links: { self: { diff --git a/chrome/content/zotero/xpcom/data/group.js b/chrome/content/zotero/xpcom/data/group.js index 8ae4b6987d..b63196f42b 100644 --- a/chrome/content/zotero/xpcom/data/group.js +++ b/chrome/content/zotero/xpcom/data/group.js @@ -244,7 +244,7 @@ Zotero.Group.prototype.toResponseJSON = function (options = {}) { let uri = Zotero.URI.getGroupURI(this); return { id: this.id, - version: this.clientVersion, + version: options.syncedVersionProperty ? this.version : this.clientVersion, links: { self: { href: Zotero.URI.toAPIURL(uri, options.apiURL), diff --git a/chrome/content/zotero/xpcom/data/item.js b/chrome/content/zotero/xpcom/data/item.js index f8828ef479..206de1b4b4 100644 --- a/chrome/content/zotero/xpcom/data/item.js +++ b/chrome/content/zotero/xpcom/data/item.js @@ -5869,12 +5869,6 @@ Zotero.Item.prototype.toJSON = function (options = {}) { Zotero.Item.prototype.toResponseJSON = function (options = {}) { - // Default to showing synced storage properties, since that's what the API does, and this function - // is generally used to emulate the API - if (options.syncedStorageProperties === undefined) { - options.syncedStorageProperties = true; - } - var json = this.constructor._super.prototype.toResponseJSON.call(this, options); // creatorSummary diff --git a/chrome/content/zotero/xpcom/server/server_localAPI.js b/chrome/content/zotero/xpcom/server/server_localAPI.js index 8606532ffc..3ad1c21b54 100644 --- a/chrome/content/zotero/xpcom/server/server_localAPI.js +++ b/chrome/content/zotero/xpcom/server/server_localAPI.js @@ -900,7 +900,8 @@ async function toResponseJSON(dataObjectOrObjects, searchParams) { let responseJSON = dataObject.toResponseJSONAsync ? await dataObject.toResponseJSONAsync({ apiURL: `http://localhost:${Zotero.Server.port}/api/`, - includeGroupDetails: true + includeGroupDetails: true, + syncedVersionProperty: false, }) : dataObject;