Ghost/ghost/admin/app/components/gh-publishmenu-scheduled.hbs
Kevin Ansfield 623825f8f0 🐛 Fixed scheduled send-only post switching to publish+send when rescheduling
closes https://github.com/TryGhost/Ghost/issues/14354

When setting/cleaning up the publish menu state we were incorrectly reverting to the default "publish & send" state when a post was already set to be email-only. This resulted in an unexpected and non-obvious switch to "publish & send" when re-scheduling a scheduled email-only post.

- updated the publish menu setup and cleanup routines to account for scheduled, email-only posts
- fixed the header in the publish menu to say "sent" rather than "published" when an email-only post is scheduled
2022-03-31 17:11:06 +01:00

53 lines
2.8 KiB
Handlebars

<div data-test-publishmenu-scheduled="true" ...attributes>
<header class="gh-publishmenu-heading" data-test-publishmenu-header>Will be {{if @emailOnly "sent" "published"}} in {{this.timeToPublished}}</header>
<div class="gh-publishmenu-content">
<section class="gh-publishmenu-section">
<div class="gh-publishmenu-radio {{if (eq @saveType "draft") "active"}}" {{on "click" (fn this.setSaveType "draft")}}>
<div class="gh-publishmenu-radio-button" data-test-publishmenu-draft-option></div>
<div class="gh-publishmenu-radio-content">
<div class="gh-publishmenu-radio-label">Revert to draft</div>
<div class="gh-publishmenu-radio-desc">Do not publish</div>
</div>
</div>
<div class="gh-publishmenu-radio {{if (eq @saveType "schedule") "active"}}" {{on "click" (fn this.setSaveType "schedule")}}>
<div class="gh-publishmenu-radio-button" data-test-publishmenu-scheduled-option></div>
<div class="gh-publishmenu-radio-content">
<div class="gh-publishmenu-radio-label">Schedule for later</div>
<GhDateTimePicker
@date={{@post.publishedAtBlogDate}}
@time={{@post.publishedAtBlogTime}}
@setDate={{this.setDate}}
@setTime={{this.setTime}}
@setTypedDateError={{@setTypedDateError}}
@errors={{@post.errors}}
@dateErrorProperty="publishedAtBlogDate"
@timeErrorProperty="publishedAtBlogTime"
@minDate={{this.minDate}}
@isActive={{eq @saveType "schedule"}}
/>
<div class="gh-publishmenu-radio-desc">Set automatic future publish date</div>
</div>
</div>
</section>
{{#if @canSendEmail}}
<section class="gh-publishmenu-section">
<div class="gh-publishmenu-email">
{{#if @isSendingEmailLimited}}
<p>{{html-safe @sendingEmailLimitError}}</p>
{{else}}
<div class="gh-publishmenu-email-label pe-none">
<label class="gh-publishmenu-radio-label mb3 midgrey">Send by email to</label>
<div class="form-group">
<GhMembersRecipientSelect
@filter={{@recipientsFilter}}
@disabled={{true}}
/>
</div>
</div>
{{/if}}
</div>
</section>
{{/if}}
</div>
</div>