Ghost/ghost/admin/app/components/gh-distribution-action-select.js
Kevin Ansfield b474e00cf8 🐛 Fixed inconsistent publish/send messaging in publish menu
no issue

- fixes the "publish/send" dropdown showing when mail is not allowed by tying it to the `canSendEmail` property rather than always showing when editing a draft post
  - was previously showing when mailgun is not configured and when default email recipients is set to "disabled", in both cases the recipient selection was never available so the dropdown was confusing and lead to invalid states
  - removed the unnecessary property`showEmailOnlyInput` - replaced with `@canSendEmail`
  - removed the unnecessary property `nextActionName` - it always resulted in "publish" because it was only being shown for pages and pages can't be sent by email
- removed the logic for setting the initial selected option in `<GhDistributionActionSelect>` because it meant the select was not directly tied to the real distribution action value leading to mixed states across components. Switched to using the passed in `@distributionAction` value directly.
- fixed the publish button incorrectly showing "Publish & send" when no send would be occurring for a post
  - if "Publish & Send" is selected, the button will now show "Publish" when no recipients are selected
- fixed the publish button incorrectly showing "Publish & send" for pages
- fixed the now/schedule radio texts not changing when publish type was set to "Send" - the conditionals were incorrectly looking at `this.args.post.emailOnly` which is incorrect syntax would only update _after_ saving, switched to the menu's internal `@emailOnly` argument instead
2021-10-21 13:08:08 +01:00

25 lines
612 B
JavaScript

import Component from '@glimmer/component';
import {action} from '@ember/object';
export default class GhDistributionActionSelect extends Component {
availablePublishActions = [{
value: 'publish_send',
name: 'publish & send'
}, {
value: 'publish',
name: 'publish'
}, {
value: 'send',
name: 'send'
}];
get distributionValue() {
return this.availablePublishActions.findBy('value', this.args.distributionAction);
}
@action
setDistributionAction(newAction) {
this.args.setDistributionAction(newAction.value);
}
}