Ghost/ghost/admin/app/components/editor/modals/publish-flow/confirm.hbs
Kevin Ansfield e3db911108
🐛 Fixed confusing error state when publishing if member count is over hosting plan limit (#15473)
closes https://github.com/TryGhost/Team/issues/1885

- adds limit check for members to the `PublishOptions` class when it's constructed to set a `publishDisabledError` property if the limit check fails
  - if `publishOptions.publishDisabledCheck` is present, all publish options in the publish flow are disabled, the underlying error message is shown, and the continue button is removed to prevent filling in everything only to find at the end of the process that publishing fails
- added handling for a `HostLimitError` error from the API when confirming publishing so the proper underlying message is displayed instead of the confusing "Host limit error, cannot edit post" error
  - this is a backup measure for any instances where you're under the max members limit when starting the publish flow but are over the limit when you reach the end of the publish flow
2022-09-26 17:37:35 +01:00

74 lines
2.6 KiB
Handlebars

<div class="gh-publish-title" data-test-publish-flow="confirm">
<div class="green">Ready, set, publish.</div>
<div>Share it with the world.</div>
</div>
<p class="gh-publish-confirmation" data-test-text="confirm-details">
{{#if @publishOptions.isScheduled}}
{{#let (moment-site-tz @publishOptions.scheduledAtUTC) as |scheduledAt|}}
On
<strong>
{{moment-format scheduledAt "D MMM YYYY"}}
at
{{moment-format scheduledAt "HH:mm"}}
</strong>
your
{{/let}}
{{else}}
Your
{{/if}}
{{@publishOptions.post.displayName}}
{{#if this.willPublish}}
will be published on your site{{#if this.willEmail}}, and delivered to{{else}}.{{/if}}
{{/if}}
{{#if this.willEmail}}
{{#unless this.willPublish}}
will be delivered to
{{/unless}}
{{#let (members-count-fetcher query=(hash filter=@publishOptions.fullRecipientFilter)) as |countFetcher|}}
<strong>
{{if (eq @recipientType "all") "all"}}
{{format-number countFetcher.count}}
{{!-- @recipientType = none/free/paid/all/specific --}}
{{if (not-eq @recipientType "all") @recipientType}}
</strong>
{{#if @publishOptions.onlyDefaultNewsletter}}
<strong>{{gh-pluralize countFetcher.count "subscriber" without-count=true}}</strong>{{#if this.willPublish}}.{{else}},{{/if}}
{{else}}
<strong>{{gh-pluralize countFetcher.count "subscriber" without-count=true}}</strong>
of <strong>{{@publishOptions.newsletter.name}}</strong>{{#if this.willPublish}}.{{else}},{{/if}}
{{/if}}
{{/let}}
{{#unless this.willPublish}}
and will <strong>not</strong> be published on your site.
{{/unless}}
{{/if}}
</p>
{{#if this.errorMessage}}
<p class="error gh-box gh-box-error mt3 mb3" data-test-confirm-error>
{{this.errorMessage}}
</p>
{{/if}}
<div class="gh-publish-cta">
<GhTaskButton
@task={{this.confirmTask}}
@buttonText={{this.confirmButtonText}}
@runningText={{this.confirmRunningText}}
@successText={{this.confirmSuccessText}}
@class="gh-btn gh-btn-large"
@idleClass="gh-btn-pulse"
@runningClass="gh-btn-green gh-btn-icon"
@failureClass="gh-btn-red gh-btn-icon"
data-test-button="confirm-publish"
/>
<button type="button" class="gh-btn gh-btn-link gh-btn-large gh-publish-cta-secondary" {{on "click" @cancel}} data-test-button="back-to-options">Back to settings</button>
</div>