Removed unnecessary options from default email recipients setting

refs https://github.com/TryGhost/Team/issues/496

- all/free/paid are selectable via the segment select
- radio buttons should be kept to 3-4 max
- fixed pluralisation of member count below member segment when only 1 member is selected
This commit is contained in:
Kevin Ansfield 2021-05-08 12:21:22 +01:00
parent d5e7d6cac1
commit d00d1c2052
3 changed files with 15 additions and 79 deletions

View File

@ -4,6 +4,6 @@
{{did-insert (perform this.fetchTotalsTask)}}
{{did-update (perform this.fetchSegmentTotalTask) @segment}}
>
<strong>{{format-number this.segmentTotal}}</strong> members
<strong>{{format-number this.segmentTotal}}</strong> {{gh-pluralize this.segmentTotal "member" without-count=true}}
</span>
{{/if}}

View File

@ -11,12 +11,19 @@
<div class="flex flex-column w-50">
<div class="{{if this.isDisabled "disabled-overlay"}}">
<div
class="gh-radio {{if this.isDisabledSelected "active"}}"
{{on "click" (fn this.setDefaultEmailRecipients "disabled")}}
class="gh-radio {{if this.isSegmentSelected "active"}}"
{{on "click" (fn this.setDefaultEmailRecipients "segment")}}
>
<div class="gh-radio-button"></div>
<div class="gh-radio-content">
<div class="gh-radio-label">Disabled</div>
<div class="gh-radio-label">Send emails to</div>
<div class="gh-radio-desc">
<GhMembersSegmentSelect
@segment={{this.settings.editorDefaultEmailRecipientsFilter}}
@onChange={{this.setDefaultEmailRecipientsFilter}}
@enforcedCountFilter="subscribed:true"
/>
</div>
</div>
</div>
<div
@ -38,46 +45,12 @@
</div>
</div>
<div
class="gh-radio {{if this.isAllSelected "active"}}"
{{on "click" (fn this.setDefaultEmailRecipients "all")}}
class="gh-radio {{if this.isDisabledSelected "active"}}"
{{on "click" (fn this.setDefaultEmailRecipients "disabled")}}
>
<div class="gh-radio-button"></div>
<div class="gh-radio-content">
<div class="gh-radio-label">All members</div>
</div>
</div>
<div
class="gh-radio {{if this.isFreeSelected "active"}}"
{{on "click" (fn this.setDefaultEmailRecipients "free")}}
>
<div class="gh-radio-button"></div>
<div class="gh-radio-content">
<div class="gh-radio-label">Free members</div>
</div>
</div>
<div
class="gh-radio {{if this.isPaidSelected "active"}}"
{{on "click" (fn this.setDefaultEmailRecipients "paid")}}
>
<div class="gh-radio-button"></div>
<div class="gh-radio-content">
<div class="gh-radio-label">Paid members</div>
</div>
</div>
<div
class="gh-radio {{if this.isSegmentSelected "active"}}"
{{on "click" (fn this.setDefaultEmailRecipients "segment")}}
>
<div class="gh-radio-button"></div>
<div class="gh-radio-content">
<div class="gh-radio-label">Specific segment:</div>
<div class="gh-radio-desc">
<GhMembersSegmentSelect
@segment={{this.settings.editorDefaultEmailRecipientsFilter}}
@onChange={{this.setDefaultEmailRecipientsFilter}}
@enforcedCountFilter="subscribed:true"
/>
</div>
<div class="gh-radio-label">Disabled</div>
</div>
</div>
</div>

View File

@ -29,34 +29,9 @@ export default class SettingsDefaultEmailRecipientsComponent extends Component {
this.settings.get('editorDefaultEmailRecipientsFilter') === null;
}
get isAllSelected() {
return !this.isDisabled &&
!this.segmentSelected &&
this.settings.get('editorDefaultEmailRecipients') === 'filter' &&
this.settings.get('editorDefaultEmailRecipientsFilter') === 'status:free,status:-free';
}
get isFreeSelected() {
return !this.isDisabled &&
!this.segmentSelected &&
this.settings.get('editorDefaultEmailRecipients') === 'filter' &&
this.settings.get('editorDefaultEmailRecipientsFilter') === 'status:free';
}
get isPaidSelected() {
return !this.isDisabled &&
!this.segmentSelected &&
this.settings.get('editorDefaultEmailRecipients') === 'filter' &&
this.settings.get('editorDefaultEmailRecipientsFilter') === 'status:-free';
}
get isSegmentSelected() {
const isCustomSegment = this.settings.get('editorDefaultEmailRecipients') === 'filter' &&
!this.isNobodySelected &&
!this.isAllSelected &&
!this.isFreeSelected &&
!this.isPaidSelected;
!this.isNobodySelected;
return !this.isDisabled && (this.segmentSelected || isCustomSegment);
}
@ -73,18 +48,6 @@ export default class SettingsDefaultEmailRecipientsComponent extends Component {
this.settings.set('editorDefaultEmailRecipientsFilter', null);
}
if (value === 'all') {
this.settings.set('editorDefaultEmailRecipientsFilter', 'status:free,status:-free');
}
if (value === 'free') {
this.settings.set('editorDefaultEmailRecipientsFilter', 'status:free');
}
if (value === 'paid') {
this.settings.set('editorDefaultEmailRecipientsFilter', 'status:-free');
}
if (value === 'segment') {
this.segmentSelected = true;
}