зеркало из https://github.com/mozilla/gecko-dev.git
Switch to 0.5 server API for deleting multiple ids from a collection.
This commit is contained in:
Родитель
18a57b6d35
Коммит
e95c1122bc
|
@ -61,6 +61,7 @@ Collection.prototype = {
|
|||
this._init(uri);
|
||||
this.pushFilter(new JsonFilter());
|
||||
this._full = true;
|
||||
this._ids = null;
|
||||
this._older = 0;
|
||||
this._newer = 0;
|
||||
this._data = [];
|
||||
|
@ -80,6 +81,8 @@ Collection.prototype = {
|
|||
args.push('full=1');
|
||||
if (this.sort)
|
||||
args.push('sort=' + this.sort);
|
||||
if (this.ids != null)
|
||||
args.push("ids=" + this.ids);
|
||||
|
||||
this.uri.query = (args.length > 0)? '?' + args.join('&') : '';
|
||||
},
|
||||
|
@ -91,6 +94,13 @@ Collection.prototype = {
|
|||
this._rebuildURL();
|
||||
},
|
||||
|
||||
// Apply the action to a certain set of ids
|
||||
get ids() this._ids,
|
||||
set ids(value) {
|
||||
this._ids = value;
|
||||
this._rebuildURL();
|
||||
},
|
||||
|
||||
// get only items modified before some date
|
||||
get older() { return this._older; },
|
||||
set older(value) {
|
||||
|
|
|
@ -519,15 +519,8 @@ SyncEngine.prototype = {
|
|||
// Remove the key for future uses
|
||||
delete this._delete[key];
|
||||
|
||||
// Specially handle ids deletion until we have collection?ids=,,,
|
||||
if (key == "ids") {
|
||||
for each (let id in val)
|
||||
new Resource(this.engineURL + id).delete();
|
||||
continue;
|
||||
}
|
||||
|
||||
// Send a delete for the property
|
||||
this._log.info("Sending delete for " + key + ": " + val);
|
||||
this._log.debug("Sending delete for " + key + ": " + val);
|
||||
let coll = new Collection(this.engineURL, this._recordObj);
|
||||
coll[key] = val;
|
||||
coll.delete();
|
||||
|
|
Загрузка…
Ссылка в новой задаче