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:
Daniel Lockyer 2021-08-25 12:44:34 +02:00
parent 80fa1d903e
commit 23c207cefc
11 changed files with 20 additions and 20 deletions

View File

@ -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);
}

View File

@ -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);
},

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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);

View File

@ -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');

View File

@ -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);

View File

@ -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);

View File

@ -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');

View File

@ -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);