2021-08-24 16:19:21 +03:00
|
|
|
import Component from '@glimmer/component';
|
|
|
|
import {action} from '@ember/object';
|
|
|
|
import {tracked} from '@glimmer/tracking';
|
|
|
|
|
|
|
|
export default class GhDistributionActionSelect extends Component {
|
|
|
|
@tracked
|
|
|
|
distributionValue;
|
|
|
|
|
|
|
|
constructor(...args) {
|
|
|
|
super(...args);
|
|
|
|
|
|
|
|
let distributionValue = this.args.post.emailOnly
|
|
|
|
? 'send'
|
|
|
|
: (this.args.post.emailRecipientFilter !== 'none')
|
|
|
|
? 'publish_send'
|
|
|
|
: 'publish';
|
|
|
|
this.distributionValue = this.availablePublishActions.findBy('value', distributionValue);
|
|
|
|
}
|
|
|
|
|
|
|
|
get availablePublishActions() {
|
|
|
|
return [{
|
|
|
|
value: 'publish_send',
|
|
|
|
name: 'publish & send'
|
|
|
|
}, {
|
|
|
|
value: 'publish',
|
|
|
|
name: 'publish'
|
|
|
|
}, {
|
|
|
|
value: 'send',
|
|
|
|
name: 'send'
|
|
|
|
}];
|
|
|
|
}
|
|
|
|
|
|
|
|
@action
|
2021-08-26 22:01:26 +03:00
|
|
|
setDistributionAction(newAction) {
|
2021-08-24 16:19:21 +03:00
|
|
|
this.distributionValue = newAction;
|
2021-08-26 22:01:26 +03:00
|
|
|
this.args.post.emailOnly = (newAction.value === 'send') ? true : false;
|
|
|
|
this.args.setDistributionAction(newAction.value);
|
2021-08-24 16:19:21 +03:00
|
|
|
}
|
|
|
|
}
|