This repository has been archived by the owner on Nov 28, 2022. It is now read-only.
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added polling when confirming email to show immediate error
no issue - when confirming email send, after initial save in, poll every second for a maximum of 10 seconds and check the status of the email - if it's `'success'` close the modal immediately - if it's `'failure'` switch the confirm modal to an error state - if the save fails for some other reason (validation, server error) close the modal immediately and let the normal editor error handling do it's thing - fixed confirm modal not appearing when retrying a save after a post validation failed - show email status in post status area - `"and sending to x members"` when email is pending or submitting - `"and sent to x members"` once email is fully submitted
- Loading branch information
1 parent
dbe40ab
commit 76c357a
Showing
6 changed files
with
134 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
export default class EmailFailedError extends Error { | ||
constructor(message) { | ||
super(message); | ||
this.name = 'EmailFailedError'; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,23 +1,45 @@ | ||
<header class="modal-header" data-test-modal="delete-user"> | ||
<h1>Ready to go? Here’s what happens next</h1> | ||
</header> | ||
<a class="close" href="" title="Close" {{action "closeModal"}}>{{svg-jar "close"}}<span class="hidden">Close</span></a> | ||
{{#unless errorMessage}} | ||
<header class="modal-header" data-test-modal="delete-user"> | ||
<h1>Ready to go? Here’s what happens next</h1> | ||
</header> | ||
<button class="close" title="Close" {{on "click" this.closeModal}}>{{svg-jar "close"}}<span class="hidden">Close</span></button> | ||
|
||
<div class="modal-body"> | ||
<p> | ||
Your post will be delivered to <strong>{{if this.model.paidOnly "all paid members" (pluralize this.model.memberCount "member")}}</strong> and will be published on your site{{#if this.model.isScheduled}} at the scheduled time{{/if}}. Sounds good? | ||
</p> | ||
</div> | ||
<div class="modal-body"> | ||
<p> | ||
Your post will be delivered to | ||
<strong>{{if this.model.paidOnly "all paid members" (pluralize this.model.memberCount "member")}}</strong> | ||
and will be published on your site{{#if this.model.isScheduled}} at the scheduled time{{/if}}. Sounds good? | ||
</p> | ||
</div> | ||
|
||
<div class="modal-footer"> | ||
<button {{action "closeModal"}} class="gh-btn" data-test-button="cancel-publish-and-email"> | ||
<span>Cancel</span> | ||
</button> | ||
<GhTaskButton | ||
@buttonText={{if this.model.isScheduled "Schedule" "Publish and send"}} | ||
@runningText={{if this.model.isScheduled "Scheduling..." "Publishing..."}} | ||
@task={{this.confirmTask}} | ||
@class="gh-btn gh-btn-green gh-btn-icon" | ||
data-test-button="confirm-publish-and-email" | ||
/> | ||
</div> | ||
<div class="modal-footer"> | ||
<button {{on "click" this.closeModal}} class="gh-btn" data-test-button="cancel-publish-and-email"> | ||
<span>Cancel</span> | ||
</button> | ||
<GhTaskButton | ||
@buttonText={{if this.model.isScheduled "Schedule" "Publish and send"}} | ||
@runningText={{if this.model.isScheduled "Scheduling..." "Publishing..."}} | ||
@task={{this.confirmAndCheckError}} | ||
@class="gh-btn gh-btn-green gh-btn-icon" | ||
data-test-button="confirm-publish-and-email" | ||
/> | ||
</div> | ||
|
||
{{else}} | ||
<header class="modal-header" data-test-modal="delete-user"> | ||
<h1>Failed to send email</h1> | ||
</header> | ||
<button class="close" title="Close" {{on "click" this.closeModal}}>{{svg-jar "close"}}<span class="hidden">Close</span></button> | ||
|
||
<div class="modal-body"> | ||
<p>Your post has been published but the email failed to send.</p> | ||
<p class="error">Error: {{this.errorMessage}}</p> | ||
<p>Check your <LinkTo @route="settings.labs">mailgun settings</LinkTo> if it persists.</p> | ||
</div> | ||
|
||
<div class="modal-footer"> | ||
<button {{on "click" this.closeModal}} class="gh-btn" data-test-button="cancel-publish-and-email"> | ||
<span>Close</span> | ||
</button> | ||
</div> | ||
{{/unless}} |