Don't include items in My Publications in Unfiled Items
This commit is contained in:
parent
2160b1cb87
commit
de7b56b8a1
3 changed files with 20 additions and 2 deletions
|
@ -1046,7 +1046,9 @@ Zotero.Search.prototype._buildQuery = Zotero.Promise.coroutine(function* () {
|
||||||
+ "AND itemID NOT IN "
|
+ "AND itemID NOT IN "
|
||||||
+ "(SELECT itemID FROM itemAttachments WHERE parentItemID IS NOT NULL "
|
+ "(SELECT itemID FROM itemAttachments WHERE parentItemID IS NOT NULL "
|
||||||
+ "UNION SELECT itemID FROM itemNotes WHERE parentItemID IS NOT NULL)"
|
+ "UNION SELECT itemID FROM itemNotes WHERE parentItemID IS NOT NULL)"
|
||||||
+ ")";
|
+ ") "
|
||||||
|
// Exclude My Publications
|
||||||
|
+ "AND itemID NOT IN (SELECT itemID FROM publicationsItems)";
|
||||||
}
|
}
|
||||||
|
|
||||||
if (publications) {
|
if (publications) {
|
||||||
|
|
|
@ -395,7 +395,9 @@ function createUnsavedDataObject(objectType, params = {}) {
|
||||||
itemType = params.itemType || 'book';
|
itemType = params.itemType || 'book';
|
||||||
allowedParams.push('dateAdded', 'dateModified');
|
allowedParams.push('dateAdded', 'dateModified');
|
||||||
}
|
}
|
||||||
|
if (objectType == 'item') {
|
||||||
|
allowedParams.push('inPublications');
|
||||||
|
}
|
||||||
if (objectType == 'feedItem') {
|
if (objectType == 'feedItem') {
|
||||||
params.guid = params.guid || Zotero.randomString();
|
params.guid = params.guid || Zotero.randomString();
|
||||||
allowedParams.push('guid');
|
allowedParams.push('guid');
|
||||||
|
|
|
@ -296,6 +296,20 @@ describe("Zotero.Search", function() {
|
||||||
assert.notInclude(matches, item.id);
|
assert.notInclude(matches, item.id);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe("unfiled", function () {
|
||||||
|
it("shouldn't include items in My Publications", function* () {
|
||||||
|
var item1 = yield createDataObject('item');
|
||||||
|
var item2 = yield createDataObject('item', { inPublications: true });
|
||||||
|
|
||||||
|
var s = new Zotero.Search;
|
||||||
|
s.libraryID = Zotero.Libraries.userLibraryID;
|
||||||
|
s.addCondition('unfiled', 'true');
|
||||||
|
var matches = yield s.search();
|
||||||
|
assert.include(matches, item1.id);
|
||||||
|
assert.notInclude(matches, item2.id);
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue