mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Added default options to transactional model methods
no-issue This protects against calling model methods without passing an options object
This commit is contained in:
parent
97d797f97a
commit
92151a7b5d
2 changed files with 6 additions and 6 deletions
|
@ -28,7 +28,7 @@ const MemberStripeCustomer = ghostBookshelf.Model.extend({
|
|||
return this.add(data, unfilteredOptions);
|
||||
},
|
||||
|
||||
add(data, unfilteredOptions) {
|
||||
add(data, unfilteredOptions = {}) {
|
||||
if (!unfilteredOptions.transacting) {
|
||||
return ghostBookshelf.transaction((transacting) => {
|
||||
return this.add(data, Object.assign({transacting}, unfilteredOptions));
|
||||
|
@ -37,7 +37,7 @@ const MemberStripeCustomer = ghostBookshelf.Model.extend({
|
|||
return ghostBookshelf.Model.add.call(this, data, unfilteredOptions);
|
||||
},
|
||||
|
||||
edit(data, unfilteredOptions) {
|
||||
edit(data, unfilteredOptions = {}) {
|
||||
if (!unfilteredOptions.transacting) {
|
||||
return ghostBookshelf.transaction((transacting) => {
|
||||
return this.edit(data, Object.assign({transacting}, unfilteredOptions));
|
||||
|
@ -46,7 +46,7 @@ const MemberStripeCustomer = ghostBookshelf.Model.extend({
|
|||
return ghostBookshelf.Model.edit.call(this, data, unfilteredOptions);
|
||||
},
|
||||
|
||||
destroy(unfilteredOptions) {
|
||||
destroy(unfilteredOptions = {}) {
|
||||
if (!unfilteredOptions.transacting) {
|
||||
return ghostBookshelf.transaction((transacting) => {
|
||||
return this.destroy(Object.assign({transacting}, unfilteredOptions));
|
||||
|
|
|
@ -230,7 +230,7 @@ const Member = ghostBookshelf.Model.extend({
|
|||
return options;
|
||||
},
|
||||
|
||||
add(data, unfilteredOptions) {
|
||||
add(data, unfilteredOptions = {}) {
|
||||
if (!unfilteredOptions.transacting) {
|
||||
return ghostBookshelf.transaction((transacting) => {
|
||||
return this.add(data, Object.assign({transacting}, unfilteredOptions));
|
||||
|
@ -239,7 +239,7 @@ const Member = ghostBookshelf.Model.extend({
|
|||
return ghostBookshelf.Model.add.call(this, data, unfilteredOptions);
|
||||
},
|
||||
|
||||
edit(data, unfilteredOptions) {
|
||||
edit(data, unfilteredOptions = {}) {
|
||||
if (!unfilteredOptions.transacting) {
|
||||
return ghostBookshelf.transaction((transacting) => {
|
||||
return this.edit(data, Object.assign({transacting}, unfilteredOptions));
|
||||
|
@ -248,7 +248,7 @@ const Member = ghostBookshelf.Model.extend({
|
|||
return ghostBookshelf.Model.edit.call(this, data, unfilteredOptions);
|
||||
},
|
||||
|
||||
destroy(unfilteredOptions) {
|
||||
destroy(unfilteredOptions = {}) {
|
||||
if (!unfilteredOptions.transacting) {
|
||||
return ghostBookshelf.transaction((transacting) => {
|
||||
return this.destroy(Object.assign({transacting}, unfilteredOptions));
|
||||
|
|
Loading…
Add table
Reference in a new issue