mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-21 01:41:46 +03:00
107ed0e1f3
refs https://github.com/TryGhost/Team/issues/947 - With email-only posts there's a new "send" status that deserved it's own publishing action in the post publish menu. With with addition the post ended up having few more publishing states: publish, send, and publish&send. In addition to all this there's a "schedule" option. An addition of the "send" only select option there became a need to persist the "email_only" flag when the option was changed in the publish menu. Such persistance was not done before from the publishing menu and led a whole chain of additional methods being passed down from publishmenu component all the way down to distribution-action-select component - At this moment only a happy path work properly when selecting one of the publishing options and publishing. More states will need to be handled for scheduled, unblished, etc. states of the post
40 lines
1.1 KiB
JavaScript
40 lines
1.1 KiB
JavaScript
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
|
|
setDistributionAction(newAction) {
|
|
this.distributionValue = newAction;
|
|
this.args.post.emailOnly = (newAction.value === 'send') ? true : false;
|
|
this.args.setDistributionAction(newAction.value);
|
|
}
|
|
}
|