mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-25 03:44:29 +03:00
🐛 Fixed email newsletter settings (#1641)
closes https://github.com/TryGhost/Ghost/issues/12052 * Added breaking test for mailgun settings * 🐛 Fixed mailgun settings to always set a baseUrl This matches the functionality seen before the bulk_email_settings were split, where the baseUrl was set when any of the mailgun settings were.
This commit is contained in:
parent
4b0f1a18d6
commit
97feab1002
@ -1,3 +1,3 @@
|
||||
<input type="checkbox" checked={{this.value}} disabled={{this.disabled}} id={{this.for}} name={{this.name}} onclick={{action (mut this.value) value="target.checked"}}>
|
||||
<input type="checkbox" data-test-toggle={{this.testKey}} checked={{this.value}} disabled={{this.disabled}} id={{this.for}} name={{this.name}} onclick={{action (mut this.value) value="target.checked"}}>
|
||||
<span class="input-toggle-component"></span>
|
||||
{{{yield}}}
|
||||
|
@ -356,6 +356,7 @@
|
||||
@value={{readonly this.mailgunSettings.domain}}
|
||||
@input={{action "setMailgunDomain"}}
|
||||
@class="mt1"
|
||||
data-test-mailgun-domain-input={{true}}
|
||||
/>
|
||||
</GhFormGroup>
|
||||
</div>
|
||||
@ -371,6 +372,7 @@
|
||||
@value={{readonly this.mailgunSettings.apiKey}}
|
||||
@input={{action "setMailgunApiKey"}}
|
||||
@class="mt1 password" @autocomplete="new-password"
|
||||
data-test-mailgun-api-key-input={{true}}
|
||||
/>
|
||||
<a href="https://app.mailgun.com/app/account/security/api_keys" target="_blank" class="mt1 fw4 f8">
|
||||
Find your Mailgun API keys here »
|
||||
|
@ -136,10 +136,16 @@ export default Component.extend({
|
||||
|
||||
setMailgunDomain(event) {
|
||||
this.set('settings.mailgunDomain', event.target.value);
|
||||
if (!this.get('settings.mailgunBaseUrl')) {
|
||||
this.set('settings.mailgunBaseUrl', this.mailgunRegion.baseUrl);
|
||||
}
|
||||
},
|
||||
|
||||
setMailgunApiKey(event) {
|
||||
this.set('settings.mailgunApiKey', event.target.value);
|
||||
if (!this.get('settings.mailgunBaseUrl')) {
|
||||
this.set('settings.mailgunBaseUrl', this.mailgunRegion.baseUrl);
|
||||
}
|
||||
},
|
||||
|
||||
setMailgunRegion(region) {
|
||||
|
@ -19,7 +19,9 @@
|
||||
<div class="gh-setting-desc pl5 pb5">Create registered members and take subscription payments — <a href="https://ghost.org/docs/members/" target="_blank" rel="noopener">Find out more</a></div>
|
||||
</div>
|
||||
<div class="gh-setting-action">
|
||||
<div class="for-switch pa5"><GhFeatureFlag @flag="members" /></div>
|
||||
<div class="for-switch pa5">
|
||||
<GhFeatureFlag @flag="members" @testKey="enable-members"/>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{#liquid-if this.feature.labs.members}}
|
||||
@ -36,6 +38,7 @@
|
||||
@successText="Saved"
|
||||
@runningText="Saving"
|
||||
@class="gh-btn gh-btn-blue gh-btn-icon"
|
||||
data-test-button="save-members-settings"
|
||||
/>
|
||||
</div>
|
||||
{{/liquid-if}}
|
||||
|
@ -1,6 +1,6 @@
|
||||
import {authenticateSession, invalidateSession} from 'ember-simple-auth/test-support';
|
||||
import {beforeEach, describe, it} from 'mocha';
|
||||
import {click, currentURL, find, findAll} from '@ember/test-helpers';
|
||||
import {click, currentURL, fillIn, find, findAll} from '@ember/test-helpers';
|
||||
import {expect} from 'chai';
|
||||
import {fileUpload} from '../../helpers/file-upload';
|
||||
import {setupApplicationTest} from 'ember-mocha';
|
||||
@ -304,4 +304,31 @@ describe('Acceptance: Settings - Labs', function () {
|
||||
expect(iframe.getAttribute('src')).to.have.string('/settings/routes/yaml/');
|
||||
});
|
||||
});
|
||||
|
||||
describe('When logged in as Owner', function () {
|
||||
beforeEach(async function () {
|
||||
let role = this.server.create('role', {name: 'Owner'});
|
||||
this.server.create('user', {roles: [role]});
|
||||
|
||||
return await authenticateSession();
|
||||
});
|
||||
|
||||
it.only('sets the mailgunBaseUrl to the default', async function () {
|
||||
await visit('/settings/labs');
|
||||
|
||||
await click('[data-test-toggle="enable-members"]');
|
||||
|
||||
await click('[data-test-toggle-membersemail]');
|
||||
|
||||
await fillIn('[data-test-mailgun-api-key-input]', 'i_am_an_api_key');
|
||||
await fillIn('[data-test-mailgun-domain-input]', 'https://domain.tld');
|
||||
|
||||
await click('[data-test-button="save-members-settings"]');
|
||||
|
||||
let [lastRequest] = this.server.pretender.handledRequests.slice(-1);
|
||||
let params = JSON.parse(lastRequest.requestBody);
|
||||
|
||||
expect(params.settings.findBy('key', 'mailgun_base_url').value).not.to.equal(null);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user