Fixed upgrade modal not showing when theme uploads are not allowed

closes https://github.com/TryGhost/Team/issues/1193

- there was a typo in the limits modal component name that is shown when the limits service check fails when opening the upload theme modal
- added acceptance test with associated fix of modal name test selector in the template
This commit is contained in:
Kevin Ansfield 2021-11-01 18:35:21 +00:00
parent a08fbf11c3
commit e1346fdeca
3 changed files with 21 additions and 4 deletions

View File

@ -1,6 +1,6 @@
<div class="modal-content">
<header class="modal-header" data-test-modal="delete-user">
<div class="modal-content" data-test-modal="limits/custom-theme">
<header class="modal-header">
<h1>Upgrade to enable custom themes</h1>
</header>
<button class="close" title="Close" {{on "click" @close}}>{{svg-jar "close"}}<span class="hidden">Close</span></button>

View File

@ -52,7 +52,7 @@ export default class ThemeManagementService extends Service {
await this.limit.limiter.errorIfWouldGoOverLimit('customThemes', {value: '.'});
} catch (error) {
if (error.errorType === 'HostLimitError') {
return this.modals.open('modals/limit/custom-theme', {
return this.modals.open('modals/limits/custom-theme', {
message: error.message
});
}

View File

@ -119,6 +119,23 @@ describe('Acceptance: Settings - Design', function () {
it('can delete installed theme');
describe('limits', function () {
it('displays upgrade notice when custom themes are not allowed');
it('displays upgrade notice when custom themes are not allowed', async function () {
this.server.loadFixtures('configs');
const config = this.server.db.configs.find(1);
config.hostSettings = {
limits: {
customThemes: {
allowlist: ['casper', 'dawn', 'lyra'],
error: 'All our official built-in themes are available the Starter plan, if you upgrade to one of our higher tiers you will also be able to edit and upload custom themes for your site.'
}
}
};
this.server.db.configs.update(1, config);
await visit('/settings/design/change-theme');
await click('[data-test-button="upload-theme"]');
expect(find('[data-test-modal="limits/custom-theme"]'), 'limits/custom-theme modal').to.exist;
});
});
});