is it possible to configure daily email to send only if there is at least one event?

General Discussion
  • When user configure their notification level to daily digest they will receive an email every day regardless of there being any new messages on the forum. So when there is no message they get an email saying:

    There have been no active topics in the past day

    I have received feedback from users that they would prefer not to receive a message if there has been no new activity. I am using nodebb mandrill email plugin. I am not sure if this specific to plugin or is in the core. Can someone point me in the right direction how to make this change?

  • @arasbm said:

    There have been no active topics in the past day

    I don't have an exact answer, but I can steer you in the right direction...

    src/emailer.js has this code in it:

    			Plugins.fireHook('action:email.send', {
    				to: results.email,
    				from: meta.config['email:from'] || '[email protected]',
    				subject: translated[2],
    				html: translated[0],
    				plaintext: translated[1],
    				template: template,
    				uid: uid
    			});
    

    A hacky way might be to wrap that method in an if statement like this:

    if (translated[1] !== "There have been no active topics in the past day") {
    			Plugins.fireHook('action:email.send', {
    				to: results.email,
    				from: meta.config['email:from'] || '[email protected]',
    				subject: translated[2],
    				html: translated[0],
    				plaintext: translated[1],
    				template: template,
    				uid: uid
    			});
    }
    

    THIS IS NOT AN EXACT ANSWER. I'm just throwing this out there to steer towards a solution. I have no idea what translated[1] would give you...

    Using grep helps with this type of stuff...for example from your nodebb root you can do:

    grep -r "There have been no active topics in the past day"
    

    It will search recursively through and spit out the file name and line of text wherever it finds the matched string...I use this a lot for tracing functionality through nodebb core. Really helpful if you are writing plugins and want to trace the hooks to their source...

  • This post is deleted!
  • @pitaj opened gh#2455

    In the meantime, yes, we can configure this so that a digest is only sent out if you have either

    • An unread notification, or
    • A recent topic
  • You never stop to amaze me on how fast you respond to issues. Thank you! 😄


Suggested Topics


  • 0 Votes
    2 Posts
    110 Views

    The best way to avoid this is to leverage the post queue. Sadly, spammers always find creative ways to bypass filters, but the post queue will stop them dead.

  • Email Eror

    General Discussion
    0 Votes
    6 Posts
    269 Views

    @phenomlab fixed thank you.

  • 0 Votes
    5 Posts
    505 Views

    @PitaJ Ah, got it, perfect, thanks much!

    The other question I have is, how come I cannot change color on an icon I'm using for the group. I move the slider bar to make it a different color but it's still black. Any suggestions on that one?

  • 0 Votes
    8 Posts
    5k Views

    If you are only going to use mongodb definitely have multiple collections with indices that make sense. For example your users collection can have indices on username whereas your posts collection can have indices on content and userid etc.

    Well, remember that NodeBB is firstly designed with redis in mind (a simple in-memory key/value store) so that might affect the document design decisions they made for their mongodb collection.

    This is why we have one collection in our mongodb implementation. To make db.delete db.rename easy to implement. From the db perspective there is no difference between a post and user object they are both indexed by the _key field so finding them is easy. For sorting and querying we use sorted sets, they are implemented in mongo using indices on value and score.

    if embedded documents in my collection persons is more efficient than saving them in the same collection with a different key.

    I wouldn't suggest embedding lots of documents, mongodb has a document size limit of 16mb so it won't let you insert more users after some point.

  • 0 Votes
    10 Posts
    3k Views

    Might as well start a fork: boba tea club.