0
Fork 0
mirror of https://github.com/TryGhost/Ghost.git synced 2025-01-06 22:40:14 -05:00

Merge pull request #5960 from JohnONolan/emailerror

Email error message cleanup
This commit is contained in:
Sebastian Gierlinger 2015-10-19 10:30:30 +02:00
commit b9daff6932
6 changed files with 20 additions and 20 deletions

View file

@ -102,7 +102,7 @@ export default Ember.Controller.extend(ValidationEngine, {
}
});
}).catch(function () {
self.set('flowErrors', 'Please enter an email address then click "Forgot?".');
self.set('flowErrors', 'We need your email address to reset your password!');
});
}
}

View file

@ -116,7 +116,7 @@ describeComponent(
expect($input.val()).to.equal(`${currentUrl}about`);
});
it('adds "mailto:" to e-mail addresses on blur', function () {
it('adds "mailto:" to email addresses on blur', function () {
this.on('updateUrl', () => { return null; });
this.render(hbs`
{{gh-navitem-url-input baseUrl=baseUrl url=url last=isLast change="updateUrl"}}

View file

@ -102,8 +102,8 @@ function initNotifications() {
api.notifications.add({notifications: [{
type: 'info',
message: [
'Ghost is attempting to use a direct method to send e-mail.',
'It is recommended that you explicitly configure an e-mail service.',
'Ghost is attempting to use a direct method to send email.',
'It is recommended that you explicitly configure an email service.',
'See <a href=\'http://support.ghost.org/mail\' target=\'_blank\'>http://support.ghost.org/mail</a> for instructions'
].join(' ')
}]}, {context: {internal: true}});
@ -112,7 +112,7 @@ function initNotifications() {
api.notifications.add({notifications: [{
type: 'warn',
message: [
'Ghost is currently unable to send e-mail.',
'Ghost is currently unable to send email.',
'See <a href=\'http://support.ghost.org/mail\' target=\'_blank\'>http://support.ghost.org/mail</a> for instructions'
].join(' ')
}]}, {context: {internal: true}});

View file

@ -11,7 +11,7 @@ function GhostMailer(opts) {
this.transport = opts.transport || null;
}
// ## E-mail transport setup
// ## Email transport setup
// *This promise should always resolve to avoid halting Ghost::init*.
GhostMailer.prototype.init = function () {
var self = this;
@ -57,7 +57,7 @@ GhostMailer.prototype.getDomain = function () {
return domain && domain[1];
};
// Sends an e-mail message enforcing `to` (blog owner) and `from` fields
// Sends an email message enforcing `to` (blog owner) and `from` fields
// This assumes that api.settings.read('email') was already done on the API level
GhostMailer.prototype.send = function (message) {
var self = this,
@ -68,10 +68,10 @@ GhostMailer.prototype.send = function (message) {
to = message.to || false;
if (!this.transport) {
return Promise.reject(new Error('Email Error: No e-mail transport configured.'));
return Promise.reject(new Error('Error: No email transport configured.'));
}
if (!(message && message.subject && message.html && message.to)) {
return Promise.reject(new Error('Email Error: Incomplete message data.'));
return Promise.reject(new Error('Error: Incomplete message data.'));
}
sendMail = Promise.promisify(self.transport.sendMail.bind(self.transport));
@ -93,17 +93,17 @@ GhostMailer.prototype.send = function (message) {
}
response.statusHandler.once('failed', function (data) {
var reason = 'Email Error: Failed sending email';
var reason = 'Error: Failed to send email';
if (data.error && data.error.errno === 'ENOTFOUND') {
reason += ': there is no mail server at this address: ' + data.domain;
reason += ' - no mail server found at ' + data.domain;
}
reason += '.';
return reject(new Error(reason));
});
response.statusHandler.once('requeue', function (data) {
var errorMessage = 'Email Error: message was not sent, requeued. Probably will not be sent. :(';
var errorMessage = 'Error: Message could not be sent';
if (data.error && data.error.message) {
errorMessage += '\nMore info: ' + data.error.message;
@ -113,7 +113,7 @@ GhostMailer.prototype.send = function (message) {
});
response.statusHandler.once('sent', function () {
return resolve('Message was accepted by the mail server. Make sure to check inbox and spam folders. :)');
return resolve('Message sent. Double check inbox and spam folder!');
});
});
});

View file

@ -50,7 +50,7 @@ describe('Mail API', function () {
/*jshint unused:false */
done();
}).catch(function (error) {
error.message.should.eql('Email Error: No e-mail transport configured.');
error.message.should.eql('Error: No email transport configured.');
error.errorType.should.eql('EmailError');
done();
}).catch(done);
@ -61,7 +61,7 @@ describe('Mail API', function () {
/*jshint unused:false */
done();
}).catch(function (error) {
error.message.should.eql('Email Error: No e-mail transport configured.');
error.message.should.eql('Error: No email transport configured.');
error.errorType.should.eql('EmailError');
done();
}).catch(done);
@ -82,7 +82,7 @@ describe('Mail API', function () {
return MailAPI.send(mailDataNoDomain, testUtils.context.internal).then(function () {
done(new Error('Error message not shown.'));
}, function (error) {
error.message.should.startWith('Email Error: Failed sending email');
error.message.should.startWith('Error: Failed to send email');
error.errorType.should.eql('EmailError');
done();
}).catch(done);
@ -94,7 +94,7 @@ describe('Mail API', function () {
MailAPI.send(mailDataNoServer, testUtils.context.internal).then(function () {
done(new Error('Error message not shown.'));
}, function (error) {
error.message.should.eql('Email Error: Failed sending email.');
error.message.should.eql('Error: Failed to send email.');
error.errorType.should.eql('EmailError');
done();
}).catch(done);
@ -106,7 +106,7 @@ describe('Mail API', function () {
MailAPI.send(mailDataIncomplete, testUtils.context.internal).then(function () {
done(new Error('Error message not shown.'));
}, function (error) {
error.message.should.eql('Email Error: Incomplete message data.');
error.message.should.eql('Error: Incomplete message data.');
error.errorType.should.eql('EmailError');
done();
}).catch(done);
@ -140,7 +140,7 @@ describe('Mail API', function () {
console.log('res', response.mail[0]);
done(new Error('Stub did not error'));
}, function (error) {
error.message.should.startWith('Email Error: Failed sending email: there is no mail server at this address');
error.message.should.startWith('Error: Failed to send email - no mail server found at');
error.errorType.should.eql('EmailError');
done();
}).catch(done);

View file

@ -62,7 +62,7 @@ describe('Mail', function () {
descriptors.forEach(function (d) {
d.isRejected().should.be.true;
d.reason().should.be.an.instanceOf(Error);
d.reason().message.should.eql('Email Error: Incomplete message data.');
d.reason().message.should.eql('Error: Incomplete message data.');
});
done();
}).catch(done);