Browse Source

remove subject from html templates

activeAddress
Ivan Socolsky 10 years ago
parent
commit
b1cc7407ee
  1. 7
      lib/emailservice.js
  2. 4
      test/integration/server.js

7
lib/emailservice.js

@ -109,8 +109,11 @@ EmailService.prototype.start = function(opts, cb) {
});
};
EmailService.prototype._compileTemplate = function(template) {
EmailService.prototype._compileTemplate = function(template, extension) {
var lines = template.split('\n');
if (extension == '.html') {
lines.unshift('');
}
return {
subject: lines[0],
body: _.rest(lines).join('\n'),
@ -135,7 +138,7 @@ EmailService.prototype._loadTemplate = function(emailType, recipient, extension,
self._readTemplateFile(recipient.language, emailType.filename + extension, function(err, template) {
if (err) return cb(err);
return cb(null, self._compileTemplate(template));
return cb(null, self._compileTemplate(template, extension));
});
};

4
test/integration/server.js

@ -353,7 +353,7 @@ describe('Wallet service', function() {
var _readTemplateFile_old = emailService._readTemplateFile;
emailService._readTemplateFile = function(language, filename, cb) {
if (_.endsWith(filename, '.html')) {
return cb(null, 'Subject\n<html><body>{{walletName}}</body></html>');
return cb(null, '<html><body>{{walletName}}</body></html>');
} else {
_readTemplateFile_old.call(emailService, language, filename, cb);
}
@ -375,7 +375,7 @@ describe('Wallet service', function() {
one.text.should.contain(wallet.name);
one.text.should.contain(wallet.copayers[0].name);
should.exist(one.html);
one.html.should.contain('<body>');
one.html.indexOf('<html>').should.equal(0);
one.html.should.contain(wallet.name);
server.storage.fetchUnsentEmails(function(err, unsent) {
should.not.exist(err);

Loading…
Cancel
Save