Local API: Don't include annotations in collection items responses
This commit is contained in:
parent
74dfcc43c2
commit
b3360071a7
2 changed files with 14 additions and 1 deletions
|
@ -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));
|
||||
|
|
|
@ -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]);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
|
Loading…
Reference in a new issue