Local API: Don't include annotations in collection items responses

This commit is contained in:
Abe Jellinek 2024-07-31 13:19:06 -04:00
parent 74dfcc43c2
commit b3360071a7
2 changed files with 14 additions and 1 deletions

View file

@ -573,13 +573,18 @@ Zotero.Server.LocalAPI.Items = class extends LocalAPIEndpoint {
let search = new Zotero.Search();
search.libraryID = libraryID;
if (isTop) {
search.addCondition('noChildren', 'true');
}
else {
search.addCondition('includeChildren', 'true');
}
search.addCondition('includeAnnotations', 'true');
if (!pathParams.collectionKey) {
search.addCondition('includeAnnotations', 'true');
}
if (pathParams.collectionKey) {
search.addCondition('collectionID', 'is',
Zotero.Collections.getIDFromLibraryAndKey(libraryID, pathParams.collectionKey));

View file

@ -123,6 +123,14 @@ describe("Local API Server", function () {
assert.equal(response.data.parentCollection, collection.key);
assert.include(response.links.up.href, collection.key);
});
describe("/items", function () {
it("should not include annotations", async function () {
let { response } = await apiGet(`/users/0/collections/${subcollection.key}/items`);
assert.isArray(response);
assert.sameMembers(response.map(item => item.key), [subcollectionItem.key, subcollectionAttachment.key]);
});
});
});
});