diff --git a/ghost/core/test/e2e-api/admin/pages-bulk.test.js b/ghost/core/test/e2e-api/admin/pages-bulk.test.js index b6c6d39ff6c5..d88145905106 100644 --- a/ghost/core/test/e2e-api/admin/pages-bulk.test.js +++ b/ghost/core/test/e2e-api/admin/pages-bulk.test.js @@ -124,10 +124,10 @@ describe('Pages Bulk API', function () { const products = await models.Product.findAll(); - const freeTier = products.models[0]; - const paidTier = products.models[1]; + const tier1 = products.models[0]; + const tier2 = products.models[1]; - assert(freeTier.id && paidTier.id); + assert(tier1.id && tier2.id); // Check all the pages that should be affected const changedPages = await models.Post.findPage({filter: forcePageFilter(filter), limit: 1, status: 'all'}); @@ -144,12 +144,10 @@ describe('Pages Bulk API', function () { visibility: 'tiers', tiers: [ { - id: freeTier.id, - type: freeTier.get('type') + id: tier1.id }, { - id: paidTier.id, - type: paidTier.get('type') + id: tier2.id } ] } @@ -166,7 +164,7 @@ describe('Pages Bulk API', function () { for (const page of pages) { assert(page.get('visibility') === 'tiers', `Expect page ${page.id} to have access 'tiers'`); - assert.equal(page.related('tiers').length, 1); // Only the paid tier, not the free tier + assert.equal(page.related('tiers').length, 2); } }); diff --git a/ghost/core/test/e2e-api/admin/posts-bulk.test.js b/ghost/core/test/e2e-api/admin/posts-bulk.test.js index fe64ddb729dd..ff23a7205625 100644 --- a/ghost/core/test/e2e-api/admin/posts-bulk.test.js +++ b/ghost/core/test/e2e-api/admin/posts-bulk.test.js @@ -159,10 +159,10 @@ describe('Posts Bulk API', function () { const products = await models.Product.findAll(); - const freeTier = products.models[0]; - const paidTier = products.models[1]; + const tier1 = products.models[0]; + const tier2 = products.models[1]; - assert(freeTier.id && paidTier.id); + assert(tier1.id && tier2.id); // Check all the posts that should be affected const changedPosts = await models.Post.findPage({filter, limit: 1, status: 'all'}); @@ -179,12 +179,10 @@ describe('Posts Bulk API', function () { visibility: 'tiers', tiers: [ { - id: freeTier.id, - type: freeTier.get('type') + id: tier1.id }, { - id: paidTier.id, - type: paidTier.get('type') + id: tier2.id } ] } @@ -201,7 +199,7 @@ describe('Posts Bulk API', function () { for (const post of posts) { assert(post.get('visibility') === 'tiers', `Expect post ${post.id} to have access 'tiers'`); - assert.equal(post.related('tiers').length, 1); // Only the paid tier, not the free tier + assert.equal(post.related('tiers').length, 2); } }); diff --git a/ghost/posts-service/lib/PostsService.js b/ghost/posts-service/lib/PostsService.js index a385d6221421..67f22d328be0 100644 --- a/ghost/posts-service/lib/PostsService.js +++ b/ghost/posts-service/lib/PostsService.js @@ -271,7 +271,7 @@ class PostsService { message: tpl(messages.invalidTiers) }); } - tiers = data.meta.tiers.filter(t => t.type === 'paid'); + tiers = data.meta.tiers; } return await this.#updatePosts({visibility: data.meta.visibility, tiers}, {filter: options.filter, context: options.context}); }