Restore Mailing List Mode Daily Summary

For a variety of reasons the option for mailing list mode users to receive a daily summary email was removed. It turns out there are a handful of communities that relied on this feature and as such it provoked a good discussion about the restoration of the feature. It was mentioned in that topic that I was working on this. Thanks to @lkramer and team for sponsoring this work! :tada:

https://github.com/joebuhlig/discourse-mlm-daily-summary

This plugin adds an option to the email preferences for a user and allows them to enable the daily emails. It is NOT dependent on mailing list mode being turned on.

I should note that this essentially takes the code that was removed and wraps it up in plugin form. In the production scenario we’ve tested it in we even saw the email text/content customizations automatically pull in without extra work. The only change that was made was the addition of the standalone user preference.

Putting the code back in place is only part of the equation. It’s to be expected that admins will want to automatically turn this on for users that previously received the email. To do that you’ll need SSH access. Then you can follow these steps:

  1. Make sure you have a backup in place. Just to be safe.
  2. Enter the app and start a rails console.
    cd /var/discourse
    ./launcher enter app 
    rails c
    
  3. Run this command:
    UserOption.where(mailing_list_mode: 'f', email_digests: 't', digest_after_minutes: 1440).pluck(:user_id).each do |id| UserCustomField.find_or_create_by(user_id: id, name: "user_mlm_daily_summary_enabled").update(value: "true") end
    

EDIT:

It was brought to my attention that the Daily Activity email should probably be turned off for these users as well. To do that, you’ll need to run this command as well, but only after the previous one:

UserCustomField.where(name: "user_mlm_daily_summary_enabled", value: "true").pluck(:user_id).each do |id| UserOption.find_by(user_id: id).update(email_digests: 'f') end
22 Likes

@joebuhlig This started spitting errors since v1.9.0.beta15, see:

https://meta.discourse.org/t/jobs-enqueuemlmdailysummary-spitting-errors/75504

Looks like an issue that likely started about a month ago and is due to this commit:

https://github.com/discourse/discourse/commit/1f14350220b4df9ee0bdc3c6bf1e7794b7c494fc#diff-4676c008b11a5480d73d4a6de01e45b9

So as a result:

https://github.com/joebuhlig/discourse-mlm-daily-summary/commit/6fd07d4c177fbcc92fb227c347a0b0316441794b

8 Likes

Thanks Joe,

I have updated the Plugin on our sandbox, no more error messages there (I manually triggered the sidekiq job).

3 Likes

Is there any way I could change the words summaries and summary to digests and digest? Like many other interested in this, I’m migrating a mailing list, and my users are accustomed to “digest”. I think there’s too much potential for confusions with the builtin “actvity summary” and this plugin’s “daily summary”.

Thanks!

You can! Go to Admin → Customize → Text Content. From there you can search for the strings you find in the locales and make changes to them from there.

4 Likes

Excellent, thanks! I had no idea plugin text could be changed in this way.

Discourse is surprisingly messy with the wordings here. Besides this, I noticed that "digest is still used in the bootstrap message, and in Admin -> Email -> Preview DIGEST. Makes me wonder how many orphaned artifacts are still floating around.

2 Likes

The discussion and screenshots I’ve seen of this feature when it was builtin was that the daily digest was a sub-option of mailing list mode, in the dropdown. Now it’s a separate options, visually at the same level as, and unrelated to mailing mist mode, but the name still says mailing list mode. Does the MLM checkbox and dropdown affect the daily digest? Yesterday I installed the plugin on my test instance and enabled digest mode for my account, but did not enable MLM. No digest has been received.

Out of curiosity, Was this a deliberate change, a side-effect of moving from builtin to plugin functionality, or something else?

I’m planning to create/activate accounts for me users, and enable daily summary for whomever mailman digest had been enabled. Since there are new accounts, I don’t have any prior values in Discourse to check, so I’m planning to set feed it a list of user_ids.

Edit: I’m not sure why I had problems earlier, but for the record, it appears that either of the following will work:

foo.custom_fields["user_mlm_daily_summary_enabled"] = true

UserCustomField.find_or_create_by(user_id: <USER_ID>, name: "user_mlm_daily_summary_enabled").update(value: "true")

The second one requires me to look up <USER_ID>, but besides this extra step, is there any advantage to using one over the other?

Thanks.

It’s been a while, but I believe they are independent settings. I do know you would need to wait 24 hours as it checks every hour but only sends out to users who joined the site at that hour of the day. Does that make sense? It’s designed to prevent an overload of emails going out from the server at once.

Side effect. You could likely get it to work as a single setting but it would require consistent maintenance to make sure it doesn’t break with new versions of Discourse. And that’s the opposite of what I want in the plugins I build. I do a fair amount of extra work on these to make sure they’re as future proof as possible.

It makes sense, but it makes it a little hard to predict when the message should arrive.

After waiting another day, it seems clear that no digest messages are being sent. I have accounts with only MLM enabled, ones with MLM and digests enabled, and ones with only digest enabled. I am receiving activity summary emails, and MLM every-comment emails, but not “daily summary” emails. For some accounts the GUI was used, and for others the rails console. Any suggestions on how to troubleshoot where the problem might be?

Do you have anything in the logs or is it simply not showing up? I’m getting these from a couple sites that are running the plugin currently.

1 Like

I’m not finding anything in the logs, but maybe I’m not looking in the right place? Within the GUI (Admin -> Logs), I don’t see anything relevant. Same with viewing the contents of /var/discourse/shared/standalone/log/rails/production.log. Under Admin -> Email -> Sent, I do see messages with email type “digest”, but they appear to be the builtin activity summary, as they are sent to every inactive account and not exclusively to (or even inclusively to) accounts that have daily summaries enabled. We’re using Amazon SES for SMTP, and there haven’t been any notifications for bounces or complaints. I just enabled delivery notifications, so within a day I’ll be able to check for positive delivery.

Is there somewhere else I could be checking?

I’m specifically referring to /logs. But I would expect to see some form of email log that shows them being sent.

Out of the six entries in /logs, only two aren’t about image optimization. One is Job exception: Validation failed: Badge has already been taken, and the other is Uncaught TypeError: Cannot read property 'show' of undefined Url: https://testforum.example.com/assets/plugin-third-party-7836e591aab88af977dd1de635258536ee999055ba534a632c4b2fe8983b90b7.js. Neither seems relevant to me, but I can add more details if that would be helpful.

we where happily running discourse with discourse-mlm-daily-summary and loved that this feature came back throught the plug-in. thanks. but:

since version 2.05 of Discourse we are running into a problem with changing the user-settings for mlm-daily-summary. users cant enable/disable the daily summary. it stays on whatever value it has. it was posted on github here: https://github.com/joebuhlig/discourse-mlm-daily-summary/issues/1

has anyone an idea on how to solve this?
it is essential to our concept of using discourse!

thanks in advance,
etienne

2 Likes

Aha @david probably this needs an update to whitelist the writeable user setting?

5 Likes

thanks for your idea.

if this is the point - @joebuhlig @david - who could do this update, so we could keep this feature part of our installation here at http://forum.esbz.org?

thanks, etienne

It’s @joebuhlig’s plugin, so he will need to need to make the final change. I have made a pull request here: https://github.com/joebuhlig/discourse-mlm-daily-summary/pull/2

7 Likes

thanks a lot @david.
@joebuhlig: would be great if you could finalize this change.
looking forward - thanks, etienne