mirror of
https://github.com/zotero/zotero.git
synced 2026-10-11 03:38:25 +00:00
Fix Attachment Last Read search condition by matching at attachment level
Addresses #5978
This commit is contained in:
parent
2717aafedd
commit
b56c153125
2 changed files with 19 additions and 1 deletions
|
|
@ -345,7 +345,8 @@ Zotero.SearchConditions = new function () {
|
|||
isInTheLast: true
|
||||
},
|
||||
table: 'itemAttachments',
|
||||
field: 'lastRead'
|
||||
field: 'lastRead',
|
||||
level: 'attachment'
|
||||
},
|
||||
|
||||
// Deprecated
|
||||
|
|
|
|||
|
|
@ -834,6 +834,23 @@ describe("Zotero.Search", function () {
|
|||
});
|
||||
});
|
||||
|
||||
describe("lastRead", function () {
|
||||
it("should roll a child attachment's last-read date up to its top-level item", async function () {
|
||||
var item = await createDataObject('item', { title: 'zlastread' });
|
||||
var attachment = await importPDFAttachment(item);
|
||||
attachment.attachmentLastRead = Math.round(Date.now() / 1000);
|
||||
await attachment.saveTx();
|
||||
|
||||
var s = new Zotero.Search();
|
||||
s.libraryID = userLibraryID;
|
||||
s.addCondition('resultLevel', 'item');
|
||||
s.addCondition('lastRead', 'isInTheLast', '1 days');
|
||||
assert.sameMembers(await s.search(), [item.id]);
|
||||
|
||||
await item.eraseTx();
|
||||
});
|
||||
});
|
||||
|
||||
describe("fulltextContent", function () {
|
||||
it("should find text in HTML files", async function () {
|
||||
var s = new Zotero.Search();
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue