Restore Mailing List Mode Daily Summary

hi @joebuhlig, we are using discourse-mlm-daily-summary and it works fine for the most part.

one thing: there are some of our 1000 users where the daily summary is not send out. i checked a lot of options and cant find a pattern.

i checked the source code and found this part being crucial. is there more code that might be part of the decision if a user gets the daily summary?

  def target_user_ids
    # Users who want to receive daily mailing list emails
    enabled_ids = UserCustomField.where(name: "user_mlm_daily_summary_enabled", value: "true").pluck(:user_id)
    User.real
        .activated
        .not_suspended
        .not_silenced
        .joins(:user_option)
        .where(id: enabled_ids)
        .where(staged: false)
        .where("#{!SiteSetting.must_approve_users?} OR approved OR moderator OR admin")
        .where("date_part('hour', first_seen_at) = date_part('hour', CURRENT_TIMESTAMP)")           # where the hour of first_seen_at is the same as the current hour
        .where("COALESCE(first_seen_at, '2010-01-01') <= CURRENT_TIMESTAMP - '23 HOURS'::INTERVAL") # don't send unless you've been around for a day already
        .pluck(:id)
  end

i checked:

  • user_mlm_daily_summary_enabled is enabled for all users
  • users are all not_suspended, not_silenced, staged:false
  • users have all been around longer than a day
  • site setting must_approve_users is false
  • first_seen_at is set for all users (wasn’t for some in the beginning and i suppose if there is no ‘hour’ of first_seen_at no summary is being sent, right?)
  • i don’t know what .real and .activated is

do you have any idea where else i can check?

thanks in advance, etienne