mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-03-11 02:12:21 -05:00
Added event to integrations when created (#10588)
no issue - There was no model event being sent yet when a new integration is being created - Added this event type to our analytics listener
This commit is contained in:
parent
160d50a258
commit
23215e7d74
2 changed files with 15 additions and 0 deletions
|
@ -22,6 +22,10 @@ module.exports.init = function () {
|
|||
{
|
||||
event: 'theme.uploaded',
|
||||
name: 'Theme Uploaded'
|
||||
},
|
||||
{
|
||||
event: 'integration.added',
|
||||
name: 'Custom Integration Added'
|
||||
}
|
||||
];
|
||||
|
||||
|
|
|
@ -16,6 +16,11 @@ const Integration = ghostBookshelf.Model.extend({
|
|||
};
|
||||
},
|
||||
|
||||
emitChange: function emitChange(event, options) {
|
||||
const eventToTrigger = 'integration' + '.' + event;
|
||||
ghostBookshelf.Model.prototype.emitChange.bind(this)(this, eventToTrigger, options);
|
||||
},
|
||||
|
||||
add(data, options) {
|
||||
const addIntegration = () => {
|
||||
return ghostBookshelf.Model.add.call(this, data, options)
|
||||
|
@ -67,6 +72,12 @@ const Integration = ghostBookshelf.Model.extend({
|
|||
}
|
||||
},
|
||||
|
||||
onCreated: function onCreated(model, response, options) {
|
||||
ghostBookshelf.Model.prototype.onCreated.apply(this, arguments);
|
||||
|
||||
model.emitChange('added', options);
|
||||
},
|
||||
|
||||
permittedAttributes(...args) {
|
||||
return ghostBookshelf.Model.prototype.permittedAttributes.apply(this, args).concat(this.relationships);
|
||||
},
|
||||
|
|
Loading…
Add table
Reference in a new issue