Thanks, @baris! Happy to help.
Email Digest not working as expected
-
We did some debugging and it looks like the email digest (by default runs at 5pm in the cron job) isn't working as expected. We changed the cronjob to 10 seconds and to not send emails but output variables in the logs. The only people emailed are ones who have logged in and made a change to their user settings; doesn't matter what change, just a change will make it work correctly.
We are doing a work around at the moment but we would like this issue resolved upstream so we can stay on this same version. We are using v1.1.2. Need to change logic in the process itself or by default create user settings upon user creation if that makes sense.
-
@eclipser Submit an issue on Github.
-
-
If you set the subscribe defaults. Change the cronjob in src/user/jobs.js to run every 10 seconds. comment out the email sending bit in src/user/digest.js here
// commneted all this out so emails won't be sent for // now while testing //emailer.send('digest', userObj.uid, { // subject: '[' + meta.config.title + '] [[email:digest.subject, ' + (now.getFullYear()+ '/' + (now.getMonth()+1) + '/' + now.getDate()) + ']]', // username: userObj.username, // userslug: userObj.userslug, // url: nconf.get('url'), // site_title: meta.config.title || meta.config.browserTitle || 'NodeBB', // notifications: notifications, // recent: data.topics.topics, // interval: data.interval //}); // added for testing in the logs winston.error('[user/jobs] ' + userObj.username + ' ' + userObj.lastonline + ' test');
Restart the nodebb process. Then watch the logs with: tail logs/output.log -f
Create a fresh new user. Do not login and change any profile settings (don't save any changes) with that user you'll see in the logs that user is not included in the digest. Only when you login and make any type of profile change and save them, you will then be included in the digest log.
-
You would have to write some js code to go through all users and set their settings.
It would look something like the following
db.getSortedSetRange('users:joindate', 0, -1, function(err, uids){ var users = require('./src/users'); async.eachSeries(uids, function(uid, next) { users.updateDigestSetting(uid, 'day', next); }, function(err) { console.log('done', err); }); });