Output 'deleted' as 1 instead of true in item JSON
Good idea? Not sure, but that's what the API does.
This commit is contained in:
parent
6993ca252c
commit
c2ad4ceb0a
|
@ -3934,7 +3934,7 @@ Zotero.Item.prototype.toJSON = Zotero.Promise.coroutine(function* (options = {})
|
||||||
// Deleted
|
// Deleted
|
||||||
let deleted = this.deleted;
|
let deleted = this.deleted;
|
||||||
if (deleted || mode == 'full') {
|
if (deleted || mode == 'full') {
|
||||||
obj.deleted = deleted;
|
obj.deleted = deleted ? 1 : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
obj.dateAdded = Zotero.Date.sqlToISO8601(this.dateAdded);
|
obj.dateAdded = Zotero.Date.sqlToISO8601(this.dateAdded);
|
||||||
|
|
|
@ -859,6 +859,20 @@ describe("Zotero.Item", function () {
|
||||||
assert.isUndefined(json.date);
|
assert.isUndefined(json.date);
|
||||||
assert.isUndefined(json.numPages);
|
assert.isUndefined(json.numPages);
|
||||||
})
|
})
|
||||||
|
|
||||||
|
it("should output 'deleted' as 1", function* () {
|
||||||
|
var itemType = "book";
|
||||||
|
var title = "Test";
|
||||||
|
|
||||||
|
var item = new Zotero.Item(itemType);
|
||||||
|
item.setField("title", title);
|
||||||
|
item.deleted = true;
|
||||||
|
var id = yield item.saveTx();
|
||||||
|
item = yield Zotero.Items.getAsync(id);
|
||||||
|
var json = yield item.toJSON();
|
||||||
|
|
||||||
|
assert.strictEqual(json.deleted, 1);
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("'full' mode", function () {
|
describe("'full' mode", function () {
|
||||||
|
@ -931,7 +945,7 @@ describe("Zotero.Item", function () {
|
||||||
patchBase: patchBase
|
patchBase: patchBase
|
||||||
})
|
})
|
||||||
assert.isUndefined(json.title);
|
assert.isUndefined(json.title);
|
||||||
assert.isTrue(json.deleted);
|
assert.strictEqual(json.deleted, 1);
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user