mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-15 19:52:01 +03:00
d00d1c2052
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
63 lines
1.9 KiB
JavaScript
63 lines
1.9 KiB
JavaScript
import Component from '@glimmer/component';
|
|
import {action} from '@ember/object';
|
|
import {inject as service} from '@ember/service';
|
|
import {tracked} from '@glimmer/tracking';
|
|
|
|
export default class SettingsDefaultEmailRecipientsComponent extends Component {
|
|
@service settings;
|
|
|
|
@tracked segmentSelected = false;
|
|
|
|
get isDisabled() {
|
|
return this.settings.get('membersSignupAccess') === 'none';
|
|
}
|
|
|
|
get isDisabledSelected() {
|
|
return this.isDisabled ||
|
|
this.settings.get('editorDefaultEmailRecipients') === 'disabled';
|
|
}
|
|
|
|
get isVisibilitySelected() {
|
|
return !this.isDisabled &&
|
|
this.settings.get('editorDefaultEmailRecipients') === 'visibility';
|
|
}
|
|
|
|
get isNobodySelected() {
|
|
return !this.isDisabled &&
|
|
!this.segmentSelected &&
|
|
this.settings.get('editorDefaultEmailRecipients') === 'filter' &&
|
|
this.settings.get('editorDefaultEmailRecipientsFilter') === null;
|
|
}
|
|
|
|
get isSegmentSelected() {
|
|
const isCustomSegment = this.settings.get('editorDefaultEmailRecipients') === 'filter' &&
|
|
!this.isNobodySelected;
|
|
return !this.isDisabled && (this.segmentSelected || isCustomSegment);
|
|
}
|
|
|
|
@action
|
|
setDefaultEmailRecipients(value) {
|
|
this.segmentSelected = false;
|
|
|
|
if (['disabled', 'visibility'].includes(value)) {
|
|
this.settings.set('editorDefaultEmailRecipients', value);
|
|
return;
|
|
}
|
|
|
|
if (value === 'none') {
|
|
this.settings.set('editorDefaultEmailRecipientsFilter', null);
|
|
}
|
|
|
|
if (value === 'segment') {
|
|
this.segmentSelected = true;
|
|
}
|
|
|
|
this.settings.set('editorDefaultEmailRecipients', 'filter');
|
|
}
|
|
|
|
@action
|
|
setDefaultEmailRecipientsFilter(filter) {
|
|
this.settings.set('editorDefaultEmailRecipientsFilter', filter);
|
|
}
|
|
}
|