mirror of
https://github.com/zotero/zotero.git
synced 2026-10-11 03:38:25 +00:00
Fix serialization of the result level seeded for a migrated childNote
The condition seeded by _loadConditions() used `mode: undefined`, but toJSON() only omits the "/mode" suffix when the mode is exactly false (what parseCondition() returns), so a saved search migrated from the obsolete childNote condition serialized -- and synced -- the condition as "resultLevel/undefined".
This commit is contained in:
parent
c43f028c96
commit
d95d8f294d
2 changed files with 6 additions and 3 deletions
|
|
@ -198,7 +198,9 @@ Zotero.Searches = function () {
|
|||
search._conditions[id] = {
|
||||
id,
|
||||
condition: 'resultLevel',
|
||||
mode: undefined,
|
||||
// No mode -- parseCondition() uses false, and toJSON() only omits the
|
||||
// "/mode" suffix for an exact false
|
||||
mode: false,
|
||||
operator: 'item',
|
||||
value: ''
|
||||
};
|
||||
|
|
|
|||
|
|
@ -69,14 +69,15 @@ describe("Zotero.Search", function () {
|
|||
var resultLevel = conds.find(c => c.condition == 'resultLevel');
|
||||
assert.ok(resultLevel);
|
||||
assert.equal(resultLevel.operator, 'item');
|
||||
assert.sameMembers(s.toJSON().conditions.map(c => c.condition), ['note', 'resultLevel']);
|
||||
assert.sameMembers(await s.search(), [item.id]);
|
||||
|
||||
await item.eraseTx();
|
||||
await s.eraseTx();
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
describe("#save()", function () {
|
||||
it("should fail without a name", async function () {
|
||||
var s = new Zotero.Search;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue