mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Removed unused add/edit methods from integrations
refs 17feb14e4a
- The original commit adding this intended to add transactions, following the pattern of always forcing a transaction when we use bookshelf-relations
- (We use bookshelf-relations here because integrations have api-keys and webhooks associated wtih them and we upsert as one)
- These add and edit methods were inadvertently added to the wrong argument object/section of bookshelf (really fucking easily done, one day we will fix bookshelf so its easier to work with)
- Bottom line: these methods have never been called
- I tried moving them to the right section, but this created test failures throughout our acceptance tests:
- Error: Transaction query already complete, run with DEBUG=knex:tx for more info
- This is likely because we need to account for integrations being used as part of the auth step in the before part of tests
- In terms of yak-shaving, fixing these tests is one step too far right now. I think not having this code here at all is a better state than having it look like it works when it doesn't
This commit is contained in:
parent
714e081efc
commit
7f29bbff8a
1 changed files with 0 additions and 38 deletions
|
@ -21,44 +21,6 @@ const Integration = ghostBookshelf.Model.extend({
|
|||
ghostBookshelf.Model.prototype.emitChange.bind(this)(this, eventToTrigger, options);
|
||||
},
|
||||
|
||||
add(data, options) {
|
||||
const addIntegration = () => {
|
||||
return ghostBookshelf.Model.add.call(this, data, options)
|
||||
.then(({id}) => {
|
||||
return this.findOne({id}, options);
|
||||
});
|
||||
};
|
||||
|
||||
if (!options.transacting) {
|
||||
return ghostBookshelf.transaction((transacting) => {
|
||||
options.transacting = transacting;
|
||||
|
||||
return addIntegration();
|
||||
});
|
||||
}
|
||||
|
||||
return addIntegration();
|
||||
},
|
||||
|
||||
edit(data, options) {
|
||||
const editIntegration = () => {
|
||||
return ghostBookshelf.Model.edit.call(this, data, options)
|
||||
.then(({id}) => {
|
||||
return this.findOne({id}, options);
|
||||
});
|
||||
};
|
||||
|
||||
if (!options.transacting) {
|
||||
return ghostBookshelf.transaction((transacting) => {
|
||||
options.transacting = transacting;
|
||||
|
||||
return editIntegration();
|
||||
});
|
||||
}
|
||||
|
||||
return editIntegration();
|
||||
},
|
||||
|
||||
onSaving(integration, attrs, options) {
|
||||
ghostBookshelf.Model.prototype.onSaving.apply(this, arguments);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue