0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-24 23:48:13 -05:00

🐛 Fixed "Send" publish type not being reset when closing publish menu

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

- we were setting `emailOnly` on the publish menu component but not resetting it meaning when you re-opened the menu after previously selecting "Send" the menu would still show "Send" but the state was inconsistent because the underlying `distributionAction` property _was_ reset
- dropped setting `emailOnly` directly in favour of making it a computed property based on `distributionAction === 'send'` so we only have to worry about changing distribution action and everything else updates for us automatically
This commit is contained in:
Kevin Ansfield 2021-10-15 16:45:46 +01:00
parent b5d96c5707
commit 94c3163834

View file

@ -41,6 +41,8 @@ export default Component.extend({
hasEmailPermission: or('session.user.isOwnerOnly', 'session.user.isAdminOnly', 'session.user.isEditor'), hasEmailPermission: or('session.user.isOwnerOnly', 'session.user.isAdminOnly', 'session.user.isEditor'),
emailOnly: computed.equal('distributionAction', 'send'),
canSendEmail: computed('hasEmailPermission', 'post.{isPost,email}', 'settings.{editorDefaultEmailRecipients,membersSignupAccess,mailgunIsConfigured}', 'config.mailgunIsConfigured', function () { canSendEmail: computed('hasEmailPermission', 'post.{isPost,email}', 'settings.{editorDefaultEmailRecipients,membersSignupAccess,mailgunIsConfigured}', 'config.mailgunIsConfigured', function () {
let isDisabled = this.settings.get('editorDefaultEmailRecipients') === 'disabled' || this.settings.get('membersSignupAccess') === 'none'; let isDisabled = this.settings.get('editorDefaultEmailRecipients') === 'disabled' || this.settings.get('membersSignupAccess') === 'none';
let mailgunIsConfigured = this.settings.get('mailgunIsConfigured') || this.config.get('mailgunIsConfigured'); let mailgunIsConfigured = this.settings.get('mailgunIsConfigured') || this.config.get('mailgunIsConfigured');
@ -226,7 +228,6 @@ export default Component.extend({
setDistributionAction(distributionAction) { setDistributionAction(distributionAction) {
this.set('distributionAction', distributionAction); this.set('distributionAction', distributionAction);
this.set('emailOnly', distributionAction === 'send');
if (distributionAction === 'publish') { if (distributionAction === 'publish') {
this.set('sendEmailWhenPublished', 'none'); this.set('sendEmailWhenPublished', 'none');