v1.18.x
Barış Soner Uşaklı 6 years ago
commit d813a77a62

@ -210,7 +210,7 @@
return '<div style="vertical-align: middle; width: 32px; height: 32px; line-height: 32px; font-size: 16px; margin-right: 8px; background-color: ' + block.teaser.user['icon:bgColor'] + '; color: white; text-align: center; display: inline-block; border-radius: 50%;">' + block.teaser.user['icon:text'] + '</div>'; return '<div style="vertical-align: middle; width: 32px; height: 32px; line-height: 32px; font-size: 16px; margin-right: 8px; background-color: ' + block.teaser.user['icon:bgColor'] + '; color: white; text-align: center; display: inline-block; border-radius: 50%;">' + block.teaser.user['icon:text'] + '</div>';
} }
if (block.user.picture) { if (block.user.picture) {
return '<img style="vertical-align: middle; width: 32px; height: 32px; padding-right: 8px; border-radius: 50%" src="' + block.user.picture + '" title="' + block.user.username + '" />'; return '<img style="vertical-align: middle; width: 32px; height: 32px; padding-right: 8px; border-radius: 50%;" src="' + block.user.picture + '" title="' + block.user.username + '" />';
} }
return '<div style="vertical-align: middle; width: 32px; height: 32px; line-height: 32px; font-size: 16px; margin-right: 8px; background-color: ' + block.user['icon:bgColor'] + '; color: white; text-align: center; display: inline-block; border-radius: 50%;">' + block.user['icon:text'] + '</div>'; return '<div style="vertical-align: middle; width: 32px; height: 32px; line-height: 32px; font-size: 16px; margin-right: 8px; background-color: ' + block.user['icon:bgColor'] + '; color: white; text-align: center; display: inline-block; border-radius: 50%;">' + block.user['icon:text'] + '</div>';
} }

@ -195,14 +195,14 @@ Emailer.send = function (template, uid, params, callback) {
settings: async.apply(User.getSettings, uid), settings: async.apply(User.getSettings, uid),
}, next); }, next);
}, },
async function (results, next) { async function (results) {
if (!results.email) { if (!results.email) {
winston.warn('uid : ' + uid + ' has no email, not sending.'); winston.warn('uid : ' + uid + ' has no email, not sending.');
return next(); return;
} }
params.uid = uid; params.uid = uid;
params.rtl = await translator.translate('[[language:dir]]', results.settings.userLang) === 'rtl'; params.rtl = await translator.translate('[[language:dir]]', results.settings.userLang) === 'rtl';
Emailer.sendToEmail(template, results.email, results.settings.userLang, params, next); Emailer.sendToEmail(template, results.email, results.settings.userLang, params, function () {});
}, },
], callback); ], callback);
}; };

@ -179,28 +179,28 @@ describe('helpers', function () {
it('should render digest avatar', function (done) { it('should render digest avatar', function (done) {
var block = { teaser: { user: { username: 'baris', picture: '/uploads/1.png' } } }; var block = { teaser: { user: { username: 'baris', picture: '/uploads/1.png' } } };
var html = helpers.renderDigestAvatar(block); var html = helpers.renderDigestAvatar(block);
assert.equal(html, '<img style="vertical-align: middle; width: 16px; height: 16px; padding-right: 8px;" src="' + block.teaser.user.picture + '" title="' + block.teaser.user.username + '" />'); assert.equal(html, '<img style="vertical-align: middle; width: 32px; height: 32px; padding-right: 8px; border-radius: 50%;" src="' + block.teaser.user.picture + '" title="' + block.teaser.user.username + '" />');
done(); done();
}); });
it('should render digest avatar', function (done) { it('should render digest avatar', function (done) {
var block = { teaser: { user: { username: 'baris', 'icon:text': 'B', 'icon:bgColor': '#ff000' } } }; var block = { teaser: { user: { username: 'baris', 'icon:text': 'B', 'icon:bgColor': '#ff000' } } };
var html = helpers.renderDigestAvatar(block); var html = helpers.renderDigestAvatar(block);
assert.equal(html, '<div style="vertical-align: middle; width: 16px; height: 16px; line-height: 16px; font-size: 10px; margin-right: 8px; background-color: ' + block.teaser.user['icon:bgColor'] + '; color: white; text-align: center; display: inline-block;">' + block.teaser.user['icon:text'] + '</div>'); assert.equal(html, '<div style="vertical-align: middle; width: 32px; height: 32px; line-height: 32px; font-size: 16px; margin-right: 8px; background-color: ' + block.teaser.user['icon:bgColor'] + '; color: white; text-align: center; display: inline-block; border-radius: 50%;">' + block.teaser.user['icon:text'] + '</div>');
done(); done();
}); });
it('should render digest avatar', function (done) { it('should render digest avatar', function (done) {
var block = { user: { username: 'baris', picture: '/uploads/1.png' } }; var block = { user: { username: 'baris', picture: '/uploads/1.png' } };
var html = helpers.renderDigestAvatar(block); var html = helpers.renderDigestAvatar(block);
assert.equal(html, '<img style="vertical-align: middle; width: 16px; height: 16px; padding-right: 8px;" src="' + block.user.picture + '" title="' + block.user.username + '" />'); assert.equal(html, '<img style="vertical-align: middle; width: 32px; height: 32px; padding-right: 8px; border-radius: 50%;" src="' + block.user.picture + '" title="' + block.user.username + '" />');
done(); done();
}); });
it('should render digest avatar', function (done) { it('should render digest avatar', function (done) {
var block = { user: { username: 'baris', 'icon:text': 'B', 'icon:bgColor': '#ff000' } }; var block = { user: { username: 'baris', 'icon:text': 'B', 'icon:bgColor': '#ff000' } };
var html = helpers.renderDigestAvatar(block); var html = helpers.renderDigestAvatar(block);
assert.equal(html, '<div style="vertical-align: middle; width: 16px; height: 16px; line-height: 16px; font-size: 10px; margin-right: 8px; background-color: ' + block.user['icon:bgColor'] + '; color: white; text-align: center; display: inline-block;">' + block.user['icon:text'] + '</div>'); assert.equal(html, '<div style="vertical-align: middle; width: 32px; height: 32px; line-height: 32px; font-size: 16px; margin-right: 8px; background-color: ' + block.user['icon:bgColor'] + '; color: white; text-align: center; display: inline-block; border-radius: 50%;">' + block.user['icon:text'] + '</div>');
done(); done();
}); });

Loading…
Cancel
Save