v1.18.x
Julian Lam 10 years ago
parent 6a837632fa
commit b3278cf8e8

@ -9,7 +9,8 @@ var async = require('async'),
user = require('../user'), user = require('../user'),
topics = require('../topics'), topics = require('../topics'),
batch = require('../batch'), batch = require('../batch'),
emailer = require('../emailer'); emailer = require('../emailer'),
utils = require('../../public/src/utils');
(function(Digest) { (function(Digest) {
Digest.execute = function(interval) { Digest.execute = function(interval) {
@ -31,6 +32,22 @@ var async = require('async'),
return winston.error('[user/jobs] Could not send digests (' + interval + '): ' + err.message); return winston.error('[user/jobs] Could not send digests (' + interval + '): ' + err.message);
} }
// Fix relative paths in topic data
data.topics.topics = data.topics.topics.map(function(topicObj) {
if (topicObj.hasOwnProperty('teaser') && topicObj.teaser !== undefined) {
if (utils.isRelativeUrl(topicObj.teaser.user.picture)) {
topicObj.teaser.user.picture = nconf.get('url') + topicObj.teaser.user.picture;
}
} else {
if (utils.isRelativeUrl(topicObj.user.picture)) {
topicObj.user.picture = nconf.get('url') + topicObj.user.picture;
}
}
return topicObj;
});
return;
data.interval = interval; data.interval = interval;
if (data.subscribers.length) { if (data.subscribers.length) {

Loading…
Cancel
Save