From 72c60d19c275b5b2bec836f14bad8501bb7a7772 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bar=C4=B1=C5=9F=20Soner=20U=C5=9Fakl=C4=B1?= Date: Tue, 21 Jul 2020 20:08:40 -0400 Subject: [PATCH] fix: tests --- src/user/digest.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/user/digest.js b/src/user/digest.js index ccf263440606..7f7044c901b2 100644 --- a/src/user/digest.js +++ b/src/user/digest.js @@ -123,14 +123,14 @@ Digest.send = async function (data) { // Fix relative paths in topic data topicsData = topicsData.map(function (topicObj) { - const user = topicObj.hasOwnProperty('teaser') && topicObj.teaser !== undefined ? topicObj.teaser.user : topicObj.user; + const user = topicObj.hasOwnProperty('teaser') && topicObj.teaser && topicObj.teaser.user ? topicObj.teaser.user : topicObj.user; if (user && user.picture && utils.isRelativeUrl(user.picture)) { user.picture = nconf.get('base_url') + user.picture; } return topicObj; }); emailsSent += 1; - const now = Date.now(); + const now = new Date(); try { await emailer.send('digest', userObj.uid, { subject: '[[email:digest.subject, ' + (now.getFullYear() + '/' + (now.getMonth() + 1) + '/' + now.getDate()) + ']]', @@ -142,7 +142,7 @@ Digest.send = async function (data) { showUnsubscribe: true, }); } catch (err) { - winston.error('[user/jobs] Could not send digest email', err.stack); + winston.error('[user/jobs] Could not send digest email\n' + err.stack); } if (data.interval !== 'alltime') {