diff --git a/ghost/collections/src/CollectionsService.ts b/ghost/collections/src/CollectionsService.ts index 3874bd31c4..8f2035eacc 100644 --- a/ghost/collections/src/CollectionsService.ts +++ b/ghost/collections/src/CollectionsService.ts @@ -559,12 +559,12 @@ export class CollectionsService { }); } - async getById(id: string): Promise { - return await this.collectionsRepository.getById(id); + async getById(id: string, options?: {transaction: Knex.Transaction}): Promise { + return await this.collectionsRepository.getById(id, options); } - async getBySlug(slug: string): Promise { - return await this.collectionsRepository.getBySlug(slug); + async getBySlug(slug: string, options?: {transaction: Knex.Transaction}): Promise { + return await this.collectionsRepository.getBySlug(slug, options); } // eslint-disable-next-line @typescript-eslint/no-explicit-any diff --git a/ghost/core/core/server/models/post.js b/ghost/core/core/server/models/post.js index 7f0289ebd8..7e89026a6d 100644 --- a/ghost/core/core/server/models/post.js +++ b/ghost/core/core/server/models/post.js @@ -700,7 +700,7 @@ Post = ghostBookshelf.Model.extend({ ) ) { try { - this.set('html', await lexicalLib.render(this.get('lexical'))); + this.set('html', await lexicalLib.render(this.get('lexical'), {transacting: options.transacting})); } catch (err) { throw new errors.ValidationError({ message: tpl(messages.invalidLexicalStructure), diff --git a/ghost/posts-service/lib/PostsService.js b/ghost/posts-service/lib/PostsService.js index 82ee000b07..97e5ffa841 100644 --- a/ghost/posts-service/lib/PostsService.js +++ b/ghost/posts-service/lib/PostsService.js @@ -44,10 +44,10 @@ class PostsService { async browsePosts(options) { let posts; if (options.collection) { - let collection = await this.collectionsService.getById(options.collection); + let collection = await this.collectionsService.getById(options.collection, {transaction: options.transacting}); if (!collection) { - collection = await this.collectionsService.getBySlug(options.collection); + collection = await this.collectionsService.getBySlug(options.collection, {transaction: options.transacting}); } if (!collection) {