mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-01-20 22:42:53 -05:00
Updated email error button text in case of partial email errors (#19877)
fixes DES-66 In case some batches succeeded sending, the button text will be different if the email sending was partially successful. For now this uses text matching with a warning in our E2E tests because we don't have a straightforward way to check if an error is partial or not yet.
This commit is contained in:
parent
e4b908479e
commit
b1c60d20d1
3 changed files with 15 additions and 2 deletions
|
@ -26,7 +26,7 @@
|
||||||
<div class="gh-publish-cta">
|
<div class="gh-publish-cta">
|
||||||
<GhTaskButton
|
<GhTaskButton
|
||||||
@task={{this.retryEmailTask}}
|
@task={{this.retryEmailTask}}
|
||||||
@buttonText="Retry sending email"
|
@buttonText={{if this.isPartialError "Send remaining emails" "Retry sending email"}}
|
||||||
@runningText="Sending"
|
@runningText="Sending"
|
||||||
@successText="Sent"
|
@successText="Sent"
|
||||||
@class="gh-btn gh-btn-large gh-btn-red"
|
@class="gh-btn gh-btn-large gh-btn-red"
|
||||||
|
|
|
@ -20,6 +20,12 @@ export default class PublishFlowCompleteWithEmailError extends Component {
|
||||||
return this.newEmailErrorMessage || this.args.emailErrorMessage;
|
return this.newEmailErrorMessage || this.args.emailErrorMessage;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
get isPartialError() {
|
||||||
|
// For now we look at the error message.
|
||||||
|
// This is covered in E2E tests so we'll be notified when this changes.
|
||||||
|
return this.emailErrorMessage && this.emailErrorMessage.includes('partially');
|
||||||
|
}
|
||||||
|
|
||||||
@task({drop: true})
|
@task({drop: true})
|
||||||
*retryEmailTask() {
|
*retryEmailTask() {
|
||||||
this.retryErrorMessage = null;
|
this.retryErrorMessage = null;
|
||||||
|
|
|
@ -761,12 +761,19 @@ describe('Batch Sending Service', function () {
|
||||||
return Promise.resolve(callCount === 12 ? false : true);
|
return Promise.resolve(callCount === 12 ? false : true);
|
||||||
});
|
});
|
||||||
const batches = new Array(101).fill(0).map(() => createModel({}));
|
const batches = new Array(101).fill(0).map(() => createModel({}));
|
||||||
|
|
||||||
|
/**
|
||||||
|
* !! WARNING !!
|
||||||
|
* If the error message is changed that it no longer contains the word 'partially',
|
||||||
|
* we'll also need the frontend logic in ghost/admin/app/components/editor/modals/publish-flow/complete-with-email-error.js
|
||||||
|
*/
|
||||||
await assert.rejects(service.sendBatches({
|
await assert.rejects(service.sendBatches({
|
||||||
email: createModel({}),
|
email: createModel({}),
|
||||||
batches,
|
batches,
|
||||||
post: createModel({}),
|
post: createModel({}),
|
||||||
newsletter: createModel({})
|
newsletter: createModel({})
|
||||||
}), /was only partially sent/);
|
}), /was only partially sent/); // do not change without reading the warning above
|
||||||
|
|
||||||
sinon.assert.callCount(sendBatch, 101);
|
sinon.assert.callCount(sendBatch, 101);
|
||||||
const sendBatches = sendBatch.getCalls().map(call => call.args[0].batch);
|
const sendBatches = sendBatch.getCalls().map(call => call.args[0].batch);
|
||||||
assert.deepEqual(sendBatches, batches);
|
assert.deepEqual(sendBatches, batches);
|
||||||
|
|
Loading…
Add table
Reference in a new issue