Better error messages if the "Send Test Email" button fails.
This commit is contained in:
parent
fa4bc90fbb
commit
d0edfe2179
|
@ -31,14 +31,21 @@ Discourse.AdminEmailIndexController = Discourse.Controller.extend({
|
||||||
@method sendTestEmail
|
@method sendTestEmail
|
||||||
**/
|
**/
|
||||||
sendTestEmail: function() {
|
sendTestEmail: function() {
|
||||||
this.set('sentTestEmail', false);
|
this.setProperties({
|
||||||
|
sendingEmail: true,
|
||||||
|
sentTestEmail: false
|
||||||
|
});
|
||||||
|
|
||||||
var adminEmailLogsController = this;
|
var self = this;
|
||||||
Discourse.ajax("/admin/email/test", {
|
Discourse.ajax("/admin/email/test", {
|
||||||
type: 'POST',
|
type: 'POST',
|
||||||
data: { email_address: this.get('testEmailAddress') }
|
data: { email_address: this.get('testEmailAddress') }
|
||||||
}).then(function () {
|
}).then(function () {
|
||||||
adminEmailLogsController.set('sentTestEmail', true);
|
self.set('sentTestEmail', true);
|
||||||
|
}).catch(function () {
|
||||||
|
bootbox.alert(I18n.t('admin.email.test_error'));
|
||||||
|
}).finally(function() {
|
||||||
|
self.set('sendingEmail', false);
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,9 @@
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<div class='admin-controls'>
|
<div class='admin-controls'>
|
||||||
|
{{#if sendingEmail}}
|
||||||
|
<div class='span15 controls'>{{i18n admin.email.sending_test}}</div>
|
||||||
|
{{else}}
|
||||||
<div class='span5 controls'>
|
<div class='span5 controls'>
|
||||||
{{textField value=testEmailAddress placeholderKey="admin.email.test_email_address"}}
|
{{textField value=testEmailAddress placeholderKey="admin.email.test_email_address"}}
|
||||||
</div>
|
</div>
|
||||||
|
@ -20,4 +23,5 @@
|
||||||
<button class='btn' {{action sendTestEmail}} {{bind-attr disabled="sendTestEmailDisabled"}}>{{i18n admin.email.send_test}}</button>
|
<button class='btn' {{action sendTestEmail}} {{bind-attr disabled="sendTestEmailDisabled"}}>{{i18n admin.email.send_test}}</button>
|
||||||
{{#if sentTestEmail}}<span class='result-message'>{{i18n admin.email.sent_test}}</span>{{/if}}
|
{{#if sentTestEmail}}<span class='result-message'>{{i18n admin.email.sent_test}}</span>{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
{{/if}}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1414,6 +1414,8 @@ en:
|
||||||
title: "Email"
|
title: "Email"
|
||||||
settings: "Settings"
|
settings: "Settings"
|
||||||
all: "All"
|
all: "All"
|
||||||
|
sending_test: "Sending test Email..."
|
||||||
|
test_error: "There was an issue sending email. Please check your settings and try again."
|
||||||
sent: "Sent"
|
sent: "Sent"
|
||||||
skipped: "Skipped"
|
skipped: "Skipped"
|
||||||
sent_at: "Sent At"
|
sent_at: "Sent At"
|
||||||
|
|
Loading…
Reference in New Issue