0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-02-17 23:44:39 -05:00

Fixed flash of copy change when confirming an email-sending publish

no issue

- `@publishOptions.willEmail` is derived state that changes when the model status changes, this was causing the text to momentarily change when confirming because saving requires the post status to be changed from `draft` to `published/scheduled`
- added static `willPublish` and `willEmail` properties to the confirm step component's backing class that are set from the data passed in during construction so we don't end up with changing copy due to underlying model updates
This commit is contained in:
Kevin Ansfield 2022-05-10 11:58:47 +01:00
parent 2e18aaaf2c
commit a1d26a575c
2 changed files with 11 additions and 6 deletions

View file

@ -19,12 +19,12 @@
{{@publishOptions.post.displayName}}
{{#if @publishOptions.willPublish}}
will be published on your site{{#if @publishOptions.willEmail}}, and delivered to{{else}}.{{/if}}
{{#if this.willPublish}}
will be published on your site{{#if this.willEmail}}, and delivered to{{else}}.{{/if}}
{{/if}}
{{#if @publishOptions.willEmail}}
{{#unless @publishOptions.willPublish}}
{{#if this.willEmail}}
{{#unless this.willPublish}}
will be delivered to
{{/unless}}
@ -42,11 +42,11 @@
<strong>{{gh-pluralize countFetcher.count "member" without-count=true}}</strong>
{{else}}
<strong>{{gh-pluralize countFetcher.count "subscriber" without-count=true}}</strong>
of <strong>{{@publishOptions.newsletter.name}}</strong>{{#if @publishOptions.willPublish}}.{{else}},{{/if}}
of <strong>{{@publishOptions.newsletter.name}}</strong>{{#if this.willPublish}}.{{else}},{{/if}}
{{/if}}
{{/let}}
{{#unless @publishOptions.willPublish}}
{{#unless this.willPublish}}
and will <strong>not</strong> be published on your site.
{{/unless}}
{{/if}}

View file

@ -5,6 +5,11 @@ import {inject as service} from '@ember/service';
export default class PublishFlowOptions extends Component {
@service settings;
// store any derived state from PublishOptions on creation so the copy
// doesn't change whilst the post is saving
willEmail = this.args.publishOptions.willEmail;
willPublish = this.args.publishOptions.willPublish;
get confirmButtonText() {
const publishType = this.args.publishOptions.publishType;