mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-24 19:33:02 +03:00
Updated signature of Bookshelf model listeners
- as per https://github.com/bookshelf/bookshelf/wiki/Migrating-from-0.15.1-to-1.0.0#different-arguments-on-after-save-event-listeners-saved-created-and-updated, the signature of saved, created and updated listeners has changed to remove the second argument - this commits updates our signatures too
This commit is contained in:
parent
80fa1d903e
commit
23c207cefc
@ -72,7 +72,7 @@ const ApiKey = ghostBookshelf.Model.extend({
|
||||
}
|
||||
}
|
||||
},
|
||||
onUpdated(model, attrs, options) {
|
||||
onUpdated(model, options) {
|
||||
if (this.previous('secret') !== this.get('secret')) {
|
||||
this.addAction(model, 'refreshed', options);
|
||||
}
|
||||
|
@ -128,7 +128,7 @@ module.exports = function (Bookshelf) {
|
||||
}
|
||||
},
|
||||
|
||||
onCreated(model, attrs, options) {
|
||||
onCreated(model, options) {
|
||||
this.addAction(model, 'added', options);
|
||||
},
|
||||
|
||||
@ -189,7 +189,7 @@ module.exports = function (Bookshelf) {
|
||||
});
|
||||
},
|
||||
|
||||
onUpdated(model, attrs, options) {
|
||||
onUpdated(model, options) {
|
||||
this.addAction(model, 'edited', options);
|
||||
},
|
||||
|
||||
|
@ -59,13 +59,13 @@ const Email = ghostBookshelf.Model.extend({
|
||||
ghostBookshelf.Model.prototype.emitChange.bind(this)(this, eventToTrigger, options);
|
||||
},
|
||||
|
||||
onCreated: function onCreated(model, attrs, options) {
|
||||
onCreated: function onCreated(model, options) {
|
||||
ghostBookshelf.Model.prototype.onCreated.apply(this, arguments);
|
||||
|
||||
model.emitChange('added', options);
|
||||
},
|
||||
|
||||
onUpdated: function onUpdated(model, attrs, options) {
|
||||
onUpdated: function onUpdated(model, options) {
|
||||
ghostBookshelf.Model.prototype.onUpdated.apply(this, arguments);
|
||||
|
||||
model.emitChange('edited', options);
|
||||
|
@ -36,7 +36,7 @@ const Integration = ghostBookshelf.Model.extend({
|
||||
}
|
||||
},
|
||||
|
||||
onCreated: function onCreated(model, response, options) {
|
||||
onCreated: function onCreated(model, options) {
|
||||
ghostBookshelf.Model.prototype.onCreated.apply(this, arguments);
|
||||
|
||||
model.emitChange('added', options);
|
||||
|
@ -14,13 +14,13 @@ Label = ghostBookshelf.Model.extend({
|
||||
ghostBookshelf.Model.prototype.emitChange.bind(this)(this, eventToTrigger, options);
|
||||
},
|
||||
|
||||
onCreated: function onCreated(model, attrs, options) {
|
||||
onCreated: function onCreated(model, options) {
|
||||
ghostBookshelf.Model.prototype.onCreated.apply(this, arguments);
|
||||
|
||||
model.emitChange('added', options);
|
||||
},
|
||||
|
||||
onUpdated: function onUpdated(model, attrs, options) {
|
||||
onUpdated: function onUpdated(model, options) {
|
||||
ghostBookshelf.Model.prototype.onUpdated.apply(this, arguments);
|
||||
|
||||
model.emitChange('edited', options);
|
||||
|
@ -140,13 +140,13 @@ const Member = ghostBookshelf.Model.extend({
|
||||
ghostBookshelf.Model.prototype.emitChange.bind(this)(this, eventToTrigger, options);
|
||||
},
|
||||
|
||||
onCreated: function onCreated(model, attrs, options) {
|
||||
onCreated: function onCreated(model, options) {
|
||||
ghostBookshelf.Model.prototype.onCreated.apply(this, arguments);
|
||||
|
||||
model.emitChange('added', options);
|
||||
},
|
||||
|
||||
onUpdated: function onUpdated(model, attrs, options) {
|
||||
onUpdated: function onUpdated(model, options) {
|
||||
ghostBookshelf.Model.prototype.onUpdated.apply(this, arguments);
|
||||
|
||||
model.emitChange('edited', options);
|
||||
|
@ -301,7 +301,7 @@ Post = ghostBookshelf.Model.extend({
|
||||
* bookshelf-relations listens on `created` + `updated`.
|
||||
* We ensure that we are catching the event after bookshelf relations.
|
||||
*/
|
||||
onSaved: function onSaved(model, response, options) {
|
||||
onSaved: function onSaved(model, options) {
|
||||
ghostBookshelf.Model.prototype.onSaved.apply(this, arguments);
|
||||
|
||||
if (options.method !== 'insert') {
|
||||
@ -317,7 +317,7 @@ Post = ghostBookshelf.Model.extend({
|
||||
}
|
||||
},
|
||||
|
||||
onUpdated: function onUpdated(model, attrs, options) {
|
||||
onUpdated: function onUpdated(model, options) {
|
||||
ghostBookshelf.Model.prototype.onUpdated.apply(this, arguments);
|
||||
|
||||
model.statusChanging = model.get('status') !== model.previous('status');
|
||||
|
@ -104,14 +104,14 @@ Settings = ghostBookshelf.Model.extend({
|
||||
model.emitChange(model._previousAttributes.key + '.' + 'deleted', options);
|
||||
},
|
||||
|
||||
onCreated: function onCreated(model, response, options) {
|
||||
onCreated: function onCreated(model, options) {
|
||||
ghostBookshelf.Model.prototype.onCreated.apply(this, arguments);
|
||||
|
||||
model.emitChange('added', options);
|
||||
model.emitChange(model.attributes.key + '.' + 'added', options);
|
||||
},
|
||||
|
||||
onUpdated: function onUpdated(model, response, options) {
|
||||
onUpdated: function onUpdated(model, options) {
|
||||
ghostBookshelf.Model.prototype.onUpdated.apply(this, arguments);
|
||||
|
||||
model.emitChange('edited', options);
|
||||
|
@ -73,13 +73,13 @@ Tag = ghostBookshelf.Model.extend({
|
||||
ghostBookshelf.Model.prototype.emitChange.bind(this)(this, eventToTrigger, options);
|
||||
},
|
||||
|
||||
onCreated: function onCreated(model, attrs, options) {
|
||||
onCreated: function onCreated(model, options) {
|
||||
ghostBookshelf.Model.prototype.onCreated.apply(this, arguments);
|
||||
|
||||
model.emitChange('added', options);
|
||||
},
|
||||
|
||||
onUpdated: function onUpdated(model, attrs, options) {
|
||||
onUpdated: function onUpdated(model, options) {
|
||||
ghostBookshelf.Model.prototype.onUpdated.apply(this, arguments);
|
||||
|
||||
model.emitChange('edited', options);
|
||||
|
@ -98,7 +98,7 @@ User = ghostBookshelf.Model.extend({
|
||||
model.emitChange('deleted', options);
|
||||
},
|
||||
|
||||
onCreated: function onCreated(model, attrs, options) {
|
||||
onCreated: function onCreated(model, options) {
|
||||
ghostBookshelf.Model.prototype.onCreated.apply(this, arguments);
|
||||
|
||||
model.emitChange('added', options);
|
||||
@ -109,7 +109,7 @@ User = ghostBookshelf.Model.extend({
|
||||
}
|
||||
},
|
||||
|
||||
onUpdated: function onUpdated(model, response, options) {
|
||||
onUpdated: function onUpdated(model, options) {
|
||||
ghostBookshelf.Model.prototype.onUpdated.apply(this, arguments);
|
||||
|
||||
model.statusChanging = model.get('status') !== model.previous('status');
|
||||
|
@ -22,13 +22,13 @@ Webhook = ghostBookshelf.Model.extend({
|
||||
ghostBookshelf.Model.prototype.emitChange.bind(this)(this, eventToTrigger, options);
|
||||
},
|
||||
|
||||
onCreated: function onCreated(model, response, options) {
|
||||
onCreated: function onCreated(model, options) {
|
||||
ghostBookshelf.Model.prototype.onCreated.apply(this, arguments);
|
||||
|
||||
model.emitChange('added', options);
|
||||
},
|
||||
|
||||
onUpdated: function onUpdated(model, response, options) {
|
||||
onUpdated: function onUpdated(model, options) {
|
||||
ghostBookshelf.Model.prototype.onUpdated.apply(this, arguments);
|
||||
|
||||
model.emitChange('edited', options);
|
||||
|
Loading…
Reference in New Issue
Block a user