mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-24 06:35:49 +03:00
Ran Comped subscriptions in transaction (#360)
no-issue We were incorrectly mixing transactional and non-transactional operations. An e2e test in Ghost will be merged shortly which caught this problem.
This commit is contained in:
parent
40035c99bf
commit
73418e8749
@ -593,7 +593,8 @@ module.exports = class MemberRepository {
|
||||
if (!ghostProduct) {
|
||||
let {data: pageData} = await this._productRepository.list({
|
||||
limit: 1,
|
||||
filter: 'type:paid'
|
||||
filter: 'type:paid',
|
||||
...options
|
||||
});
|
||||
ghostProduct = (pageData && pageData[0]) || null;
|
||||
}
|
||||
@ -966,7 +967,16 @@ module.exports = class MemberRepository {
|
||||
}, options);
|
||||
}
|
||||
|
||||
async setComplimentarySubscription(data, options) {
|
||||
async setComplimentarySubscription(data, options = {}) {
|
||||
if (!options.transacting) {
|
||||
return this._Member.transaction((transacting) => {
|
||||
return this.setComplimentarySubscription(data, {
|
||||
...options,
|
||||
transacting
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
if (!this._stripeAPIService.configured) {
|
||||
throw new errors.BadRequestError(tpl(messages.noStripeConnection, {action: 'create Complimentary Subscription'}));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user