Updated Email newsletter settings

No issue

- When disabling email newsletters, the "Subscribed to email" toggle in the member profile is hidden
- Copy changes to the Default newsletter recipients setting
- Moved tiers to the top of the segment selection in Default newsletter recipients
This commit is contained in:
Sanne de Vries 2022-01-27 21:40:30 +00:00
parent d3447315ee
commit 7a7b473f89
3 changed files with 40 additions and 37 deletions

View File

@ -43,21 +43,23 @@
{{gh-count-down-characters this.scratchMember.note 500}}</p> {{gh-count-down-characters this.scratchMember.note 500}}</p>
</GhFormGroup> </GhFormGroup>
<GhFormGroup @classNames="gh-members-subscribed-checkbox mb0"> {{#if (not-eq this.settings.editorDefaultEmailRecipients "disabled")}}
<div class="flex justify-between items-center"> <GhFormGroup @classNames="gh-members-subscribed-checkbox mb0">
<div> <div class="flex justify-between items-center">
<h4 class="gh-setting-title m">Subscribed to newsletter</h4> <div>
<p class="gh-setting-desc">If disabled, member will <em>not</em> receive newsletter emails</p> <h4 class="gh-setting-title m">Subscribed to newsletter</h4>
<p class="gh-setting-desc">If disabled, member will <em>not</em> receive newsletter emails</p>
</div>
<div class="for-switch">
<label class="switch" for="subscribed-checkbox">
<Input @checked={{this.member.subscribed}} @type="checkbox" @id="subscribed-checkbox"
@name="subscribed" data-test-checkbox="member-subscribed" />
<span class="input-toggle-component"></span>
</label>
</div>
</div> </div>
<div class="for-switch"> </GhFormGroup>
<label class="switch" for="subscribed-checkbox"> {{/if}}
<Input @checked={{this.member.subscribed}} @type="checkbox" @id="subscribed-checkbox"
@name="subscribed" data-test-checkbox="member-subscribed" />
<span class="input-toggle-component"></span>
</label>
</div>
</div>
</GhFormGroup>
</div> </div>
</div> </div>

View File

@ -73,27 +73,6 @@ export default class GhMembersSegmentSelect extends Component {
}); });
} }
// fetch all labels w̶i̶t̶h̶ c̶o̶u̶n̶t̶s̶
// TODO: add `include: 'count.members` to query once API is fixed
const labels = yield this.store.query('label', {limit: 'all'});
if (labels.length > 0 && !this.args.hideLabels) {
const labelsGroup = {
groupName: 'Labels',
options: []
};
labels.forEach((label) => {
labelsGroup.options.push({
name: label.name,
segment: `label:${label.slug}`,
count: label.count?.members,
class: 'segment-label'
});
});
options.push(labelsGroup);
}
if (this.feature.get('multipleProducts')) { if (this.feature.get('multipleProducts')) {
// fetch all products w̶i̶t̶h̶ c̶o̶u̶n̶t̶s̶ // fetch all products w̶i̶t̶h̶ c̶o̶u̶n̶t̶s̶
// TODO: add `include: 'count.members` to query once API supports // TODO: add `include: 'count.members` to query once API supports
@ -121,6 +100,28 @@ export default class GhMembersSegmentSelect extends Component {
} }
} }
// fetch all labels w̶i̶t̶h̶ c̶o̶u̶n̶t̶s̶
// TODO: add `include: 'count.members` to query once API is fixed
const labels = yield this.store.query('label', {limit: 'all'});
if (labels.length > 0 && !this.args.hideLabels) {
const labelsGroup = {
groupName: 'Labels',
options: []
};
labels.forEach((label) => {
labelsGroup.options.push({
name: label.name,
segment: `label:${label.slug}`,
count: label.count?.members,
class: 'segment-label'
});
});
options.push(labelsGroup);
}
this._options = options; this._options = options;
} }
} }

View File

@ -22,8 +22,8 @@ export default class SettingsDefaultEmailRecipientsComponent extends Component {
icon: 'members-paid', icon: 'members-paid',
icon_color: 'pink' icon_color: 'pink'
}, { }, {
name: 'Specific tier(s)', name: 'Specific people',
description: 'Only people who have a subscription to a selected tier', description: 'Only people with any of the selected tiers or labels',
value: 'segment', value: 'segment',
icon: 'members-segment', icon: 'members-segment',
icon_color: 'yellow' icon_color: 'yellow'