diff --git a/core/server/api/canary/tiers.js b/core/server/api/canary/tiers.js index 6604a44903..1e3968448d 100644 --- a/core/server/api/canary/tiers.js +++ b/core/server/api/canary/tiers.js @@ -54,7 +54,9 @@ module.exports = { } } }, - permissions: true, + permissions: { + docName: 'products' + }, async query(frame) { const model = await membersService.api.productRepository.get(frame.data, frame.options); diff --git a/package.json b/package.json index 52daa86837..99663d6a0a 100644 --- a/package.json +++ b/package.json @@ -58,7 +58,7 @@ "@nexes/nql": "0.6.0", "@sentry/node": "6.18.1", "@tryghost/adapter-manager": "0.2.28", - "@tryghost/admin-api-schema": "2.10.0", + "@tryghost/admin-api-schema": "2.11.0", "@tryghost/bookshelf-plugins": "0.3.10", "@tryghost/bootstrap-socket": "0.2.17", "@tryghost/color-utils": "0.1.8", @@ -84,7 +84,7 @@ "@tryghost/logging": "2.0.4", "@tryghost/magic-link": "1.0.20", "@tryghost/member-events": "0.4.0", - "@tryghost/members-api": "5.0.4", + "@tryghost/members-api": "5.1.0", "@tryghost/members-events-service": "0.3.1", "@tryghost/members-importer": "0.5.3", "@tryghost/members-offers": "0.10.8", diff --git a/test/e2e-api/admin/tiers.test.js b/test/e2e-api/admin/tiers.test.js index d619f9239c..2fa404d660 100644 --- a/test/e2e-api/admin/tiers.test.js +++ b/test/e2e-api/admin/tiers.test.js @@ -1,3 +1,4 @@ +const assert = require('assert'); const { agentProvider, fixtureManager, @@ -91,4 +92,29 @@ describe('Tiers API', function () { }] }); }); + + it('Can read Tiers', async function () { + const {body: {tiers: [tier]}} = await agent.get('/tiers/'); + + await agent.get(`/tiers/${tier.id}/`) + .expectStatus(200); + }); + + it('Can edit visibility', async function () { + const {body: {tiers: [tier]}} = await agent.get('/tiers/?type:paid&limit=1'); + + const visibility = tier.visibility === 'none' ? 'public' : 'none'; + + await agent.put(`/tiers/${tier.id}/`) + .body({ + tiers: [{ + visibility + }] + }) + .expectStatus(200); + + const {body: {tiers: [updatedTier]}} = await agent.get(`/tiers/${tier.id}/`); + + assert(updatedTier.visibility === visibility, `The visibility of the Tier should have been updated to ${visibility}`); + }); }); diff --git a/yarn.lock b/yarn.lock index 30655a197a..78729055eb 100644 --- a/yarn.lock +++ b/yarn.lock @@ -1744,10 +1744,10 @@ dependencies: "@tryghost/errors" "^1.2.1" -"@tryghost/admin-api-schema@2.10.0": - version "2.10.0" - resolved "https://registry.yarnpkg.com/@tryghost/admin-api-schema/-/admin-api-schema-2.10.0.tgz#5d0966f3d937251070933314d64bd1486e6c93f5" - integrity sha512-EATkl1UYNN8Xmpk7xizjjrcmZW6B97z9yAtBDt+4lPEDpdZoCd/yVau640/Y5q257lWjaXq0CeQ6O9kpN7WwJQ== +"@tryghost/admin-api-schema@2.11.0": + version "2.11.0" + resolved "https://registry.yarnpkg.com/@tryghost/admin-api-schema/-/admin-api-schema-2.11.0.tgz#13e50b70a28bd6dfee01da46dbfbed1fc9a444f5" + integrity sha512-bY6qBFkB3i71Ci2lpnOgIFvxHnHYgDg/wK/fx2v7U6rXqO8wbtqo69GELyi7BaCS+Ji/CUBCsjuFWn2idh7u3A== dependencies: "@tryghost/errors" "^0.2.10" lodash "^4.17.11" @@ -2173,10 +2173,10 @@ "@tryghost/domain-events" "^0.1.8" "@tryghost/member-events" "^0.4.0" -"@tryghost/members-api@5.0.4": - version "5.0.4" - resolved "https://registry.yarnpkg.com/@tryghost/members-api/-/members-api-5.0.4.tgz#0e9bbef7e1381e4f11ac2ac512777cc4389e57ab" - integrity sha512-/ngQfgJsCMulAcprxC7sKFQukPlrkzxVKM6Fv33eBnSlIKBCVEhUWde7Pf2bp6zb1ZKMjz6YpS+193m+aEgcXg== +"@tryghost/members-api@5.1.0": + version "5.1.0" + resolved "https://registry.yarnpkg.com/@tryghost/members-api/-/members-api-5.1.0.tgz#83280b8bd1f2a31160e3dd7a0885936ece0b3d00" + integrity sha512-JHXIg/+HPUZhm5j+EcL9h6mHUen0vaMIK8yFeLYBJXMfnl/lnd5FFVDLOTpFvo1pX+66hH2W+LonnhIspbvAaQ== dependencies: "@nexes/nql" "^0.6.0" "@tryghost/debug" "^0.1.2"