Add version
option to toResponseJSON()
This commit is contained in:
parent
3390f2405b
commit
d67c654245
|
@ -1252,12 +1252,16 @@ Zotero.DataObject.prototype._finalizeErase = Zotero.Promise.coroutine(function*
|
||||||
Zotero.DataObject.prototype.toResponseJSON = function (options) {
|
Zotero.DataObject.prototype.toResponseJSON = function (options) {
|
||||||
// TODO: library block?
|
// TODO: library block?
|
||||||
|
|
||||||
return {
|
var json = {
|
||||||
key: this.key,
|
key: this.key,
|
||||||
version: this.version,
|
version: this.version,
|
||||||
meta: {},
|
meta: {},
|
||||||
data: this.toJSON(options)
|
data: this.toJSON(options)
|
||||||
};
|
};
|
||||||
|
if (options.version) {
|
||||||
|
json.version = json.data.version = options.version;
|
||||||
|
}
|
||||||
|
return json;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -782,9 +782,9 @@ describe("Zotero.Sync.Data.Engine", function () {
|
||||||
},
|
},
|
||||||
JSON.stringify({
|
JSON.stringify({
|
||||||
successful: {
|
successful: {
|
||||||
"0": item2.toResponseJSON(),
|
"0": item2.toResponseJSON({ version: lastLibraryVersion }),
|
||||||
"1": item1.toResponseJSON(),
|
"1": item1.toResponseJSON({ version: lastLibraryVersion }),
|
||||||
"2": item3.toResponseJSON()
|
"2": item3.toResponseJSON({ version: lastLibraryVersion })
|
||||||
},
|
},
|
||||||
unchanged: {},
|
unchanged: {},
|
||||||
failed: {}
|
failed: {}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user