Better error messages if the "Send Test Email" button fails.

This commit is contained in:
Robin Ward 2014-03-18 15:25:16 -04:00
parent fa4bc90fbb
commit d0edfe2179
3 changed files with 16 additions and 3 deletions

View File

@ -31,14 +31,21 @@ Discourse.AdminEmailIndexController = Discourse.Controller.extend({
@method sendTestEmail
**/
sendTestEmail: function() {
this.set('sentTestEmail', false);
this.setProperties({
sendingEmail: true,
sentTestEmail: false
});
var adminEmailLogsController = this;
var self = this;
Discourse.ajax("/admin/email/test", {
type: 'POST',
data: { email_address: this.get('testEmailAddress') }
}).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);
});
}

View File

@ -13,6 +13,9 @@
</table>
<div class='admin-controls'>
{{#if sendingEmail}}
<div class='span15 controls'>{{i18n admin.email.sending_test}}</div>
{{else}}
<div class='span5 controls'>
{{textField value=testEmailAddress placeholderKey="admin.email.test_email_address"}}
</div>
@ -20,4 +23,5 @@
<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}}
</div>
{{/if}}
</div>

View File

@ -1414,6 +1414,8 @@ en:
title: "Email"
settings: "Settings"
all: "All"
sending_test: "Sending test Email..."
test_error: "There was an issue sending email. Please check your settings and try again."
sent: "Sent"
skipped: "Skipped"
sent_at: "Sent At"