0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-10 23:36:14 -05:00

Removed duplicate newsletter tracking settings (#15717)

refs cca0f7d7dc

- newsletter tracking setting has now moved to analytics settings page. the duplicate settings on newsletter settings page is removed.
This commit is contained in:
Rishabh Garg 2022-10-28 02:35:39 +05:30 committed by GitHub
parent 007637973e
commit d10d4390f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 69 additions and 92 deletions

View file

@ -10,7 +10,7 @@
</p> </p>
</div> </div>
<div class="for-switch"> <div class="for-switch">
<label class="switch" for="email-track-opens"> <label class="switch" for="email-track-opens" data-test-label="email-track-opens">
<input <input
id="email-track-opens" id="email-track-opens"
type="checkbox" type="checkbox"
@ -33,7 +33,7 @@
</p> </p>
</div> </div>
<div class="for-switch"> <div class="for-switch">
<label class="switch" for="email-track-clicks"> <label class="switch" for="email-track-clicks" data-test-label="email-track-clicks">
<input <input
id="email-track-clicks" id="email-track-clicks"
type="checkbox" type="checkbox"
@ -61,7 +61,7 @@
</p> </p>
</div> </div>
<div class="for-switch"> <div class="for-switch">
<label class="switch" for="members-track-sources"> <label class="switch" for="members-track-sources" data-test-label="members-track-sources">
<input <input
id="members-track-sources" id="members-track-sources"
type="checkbox" type="checkbox"

View file

@ -140,62 +140,6 @@
</div> </div>
</div> </div>
{{/unless}} {{/unless}}
<div class="gh-expandable-block">
<div class="gh-expandable-header">
<div>
<h4 class="gh-expandable-title">Newsletter analytics</h4>
<p class="gh-expandable-description">Track how many members are opening emails and clicking links</p>
</div>
<button type="button" class="gh-btn" {{on "click" (toggle-action "newsletterTrackingOpen" this)}} data-test-toggle-analytics>
<span>{{if this.newsletterTrackingOpen "Close" "Expand"}}</span>
</button>
</div>
<div class="gh-expandable-content">
{{#liquid-if this.newsletterTrackingOpen}}
<div class="mb6">
<div class="gh-newsletter-tracking">
<div class="gh-newsletter-tracking-row">
<div>
<h4 class="gh-newsletter-tracking-title">Track newsletter opens</h4>
</div>
<div class="for-switch">
<label class="switch" data-test-label="email-track-opens">
<input
id="email-track-opens"
type="checkbox"
checked={{this.settings.emailTrackOpens}}
class="gh-input"
{{on "change" this.toggleEmailTrackOpens}}
data-test-checkbox="email-track-opens"
>
<span class="input-toggle-component mt1"></span>
</label>
</div>
</div>
<div class="gh-newsletter-tracking-row">
<div>
<h4 class="gh-newsletter-tracking-title">Track newsletter link clicks</h4>
</div>
<div class="for-switch">
<label class="switch" data-test-label="email-track-clicks">
<input
id="email-track-clicks"
type="checkbox"
checked={{this.settings.emailTrackClicks}}
class="gh-input"
{{on "change" this.toggleEmailTrackClicks}}
data-test-checkbox="email-track-clicks"
>
<span class="input-toggle-component mt1"></span>
</label>
</div>
</div>
</div>
</div>
{{/liquid-if}}
</div>
</div>
</div> </div>
</section> </section>
{{/if}} {{/if}}

View file

@ -71,7 +71,7 @@ export default [
setting('members', 'stripe_connect_account_id', null), setting('members', 'stripe_connect_account_id', null),
setting('members', 'members_monthly_price_id', null), setting('members', 'members_monthly_price_id', null),
setting('members', 'members_yearly_price_id', null), setting('members', 'members_yearly_price_id', null),
setting('members', 'members_track_sources', null), setting('members', 'members_track_sources', 'true'),
// PORTAL // PORTAL
setting('portal', 'portal_name', 'true'), setting('portal', 'portal_name', 'true'),

View file

@ -0,0 +1,65 @@
import {authenticateSession} from 'ember-simple-auth/test-support';
import {click, find} from '@ember/test-helpers';
import {expect} from 'chai';
import {setupApplicationTest} from 'ember-mocha';
import {setupMirage} from 'ember-cli-mirage/test-support';
import {visit} from '../../helpers/visit';
describe('Acceptance: Settings - Analytics', function () {
const hooks = setupApplicationTest();
setupMirage(hooks);
beforeEach(async function () {
this.server.loadFixtures('configs', 'newsletters');
const role = this.server.create('role', {name: 'Owner'});
this.server.create('user', {roles: [role]});
return await authenticateSession();
});
it('can manage open rate tracking', async function () {
this.server.db.settings.update({key: 'email_track_opens'}, {value: 'true'});
await visit('/settings/analytics');
expect(find('[data-test-checkbox="email-track-opens"]')).to.be.checked;
await click('[data-test-label="email-track-opens"]');
expect(find('[data-test-checkbox="email-track-opens"]')).to.not.be.checked;
await click('[data-test-button="save-analytics-settings"]');
expect(this.server.db.settings.findBy({key: 'email_track_opens'}).value).to.equal(false);
});
it('can manage click tracking', async function () {
this.server.db.settings.update({key: 'email_track_clicks'}, {value: 'true'});
await visit('/settings/analytics');
expect(find('[data-test-checkbox="email-track-clicks"]')).to.be.checked;
await click('[data-test-label="email-track-clicks"]');
expect(find('[data-test-checkbox="email-track-clicks"]')).to.not.be.checked;
await click('[data-test-button="save-analytics-settings"]');
expect(this.server.db.settings.findBy({key: 'email_track_clicks'}).value).to.equal(false);
});
it('can manage source tracking', async function () {
this.server.db.settings.update({key: 'members_track_sources'}, {value: 'true'});
await visit('/settings/analytics');
expect(find('[data-test-checkbox="members-track-sources"]')).to.be.checked;
await click('[data-test-label="members-track-sources"]');
expect(find('[data-test-checkbox="members-track-sources"]')).to.not.be.checked;
await click('[data-test-button="save-analytics-settings"]');
expect(this.server.db.settings.findBy({key: 'members_track_sources'}).value).to.equal(false);
});
});

View file

@ -122,38 +122,6 @@ describe('Acceptance: Settings - Newsletters', function () {
expect(currentURL()).to.equal('/settings/newsletters'); expect(currentURL()).to.equal('/settings/newsletters');
}); });
it('can manage open rate tracking', async function () {
this.server.db.settings.update({key: 'email_track_opens'}, {value: 'true'});
await visit('/settings/newsletters');
await click('[data-test-toggle-analytics]');
expect(find('[data-test-checkbox="email-track-opens"]')).to.be.checked;
await click('[data-test-label="email-track-opens"]');
expect(find('[data-test-checkbox="email-track-opens"]')).to.not.be.checked;
await click('[data-test-button="save-members-settings"]');
expect(this.server.db.settings.findBy({key: 'email_track_opens'}).value).to.equal(false);
});
it('can manage click tracking', async function () {
this.server.db.settings.update({key: 'email_track_clicks'}, {value: 'true'});
await visit('/settings/newsletters');
await click('[data-test-toggle-analytics]');
expect(find('[data-test-checkbox="email-track-clicks"]')).to.be.checked;
await click('[data-test-label="email-track-clicks"]');
expect(find('[data-test-checkbox="email-track-clicks"]')).to.not.be.checked;
await click('[data-test-button="save-members-settings"]');
expect(this.server.db.settings.findBy({key: 'email_track_clicks'}).value).to.equal(false);
});
describe('Creating newsletters', function () { describe('Creating newsletters', function () {
it('can create new newsletter', async function () { it('can create new newsletter', async function () {
await visit('/settings/newsletters'); await visit('/settings/newsletters');