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>
</GhFormGroup>
<GhFormGroup @classNames="gh-members-subscribed-checkbox mb0">
<div class="flex justify-between items-center">
<div>
<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>
{{#if (not-eq this.settings.editorDefaultEmailRecipients "disabled")}}
<GhFormGroup @classNames="gh-members-subscribed-checkbox mb0">
<div class="flex justify-between items-center">
<div>
<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 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>
</GhFormGroup>
</GhFormGroup>
{{/if}}
</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')) {
// fetch all products w̶i̶t̶h̶ c̶o̶u̶n̶t̶s̶
// 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;
}
}

View File

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