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);
});
}