Notification emails not being sent for Chat as per user preference

Is there a way to force update the Preference of all users in a chat channel to receive email messages for chat?

I would like users to default to receiving emails.

Thank you.

Why would you do that? Surely the user’s preferences are what they want. When I sign up for a new DIscourse instance the very first thing I do is go to my profile and change the email perferences to Never. I would be royal annoyed to find that someone had decided that they knew better than me about how I wished to interact with Discourse. Indeed if an admin did this to me I would consider it spamming!

3 Likes

Yes, it is not for overriding what the user selects.

However, it would make sense to have initial defaults. It appears that no emails are going out currently, when we enabled the chat functionality.

In our kind of forum, people would not go in to set preferences and expect to be notified adequately.

1 Like

I’ve just checked my test site, and I believe the default for chat email notifications is ‘only when away’ (with the only alternative being ‘never’).

I think there is a case to allow for a default to be added to the User Preference admin settings, though probably for the inverse of what you’re suggesting. :slightly_smiling_face: This would work like the other defaults, in that it would only change the preference for users who had yet to select one manually.

I’ve slipped this over to #ux for consideration. :+1:

4 Likes

Thanks. But shouldn’t the default ‘Only when away’ pump out emails to everyone who hasn’t been on the site lately?

I had 300+ members on the general chat channel and only 2 messages went out.
Needless to say, most of the 300 weren’t on the site in the 15 min window.

2 Likes

You don’t get notifications for every chat message, only those where you’ve been mentioned (either your own @mention, @here and @all), so that may explain it?

4 Likes

Sorry I may not have clarified I used @ all (space added just here) but it didn’t work.

P.S. I am actually wondering why you are not added to the chit chat on my site as a recently active member. :grinning:

2 Likes

Ah, I’m afraid I deleted my test account on your site after I finished testing the post-voting comments. :slight_smile:

I’ve had a quick play on seeing if there are any quirks about when a chat user gets included in @all, but (from my very brief look) it seemed to be everyone in the channel list. You could pick a couple of users who didn’t get the email and check to see if they got the notification, as well as their chat email preference to see if they’re as they should be?

3 Likes

So here is my test:

1. Chat channel settings to notify for everything (though I think it does not affect emails).

2. I picked a member from the 313 in the channel and here are the standard user prefs - ‘Email only when away’.
Chat message with @ all created many hours back has sent notifications as seen here, but no emails.

3. No emails sent except for 2 members. Both are admins/mods and both used chat before - not sure if that is the differentiator.

4. On a separate note, it looks like Admin can’t see user’s chat preferences.

2 Likes

I’ve been exploring it a bit further this morning, and mine seem to be working okay. :thinking:

I have 6 test users, all auto-enrolled members of the ~general channel. One is an admin, and one is a brand new TL0 user who has never opened the chat channel (or chat). None of them have logged in since yesterday (apart from the new test_six user, though I made sure they had at least 15 minutes of ‘downtime’ prior to testing).

Pinging the ~general channel with @all sent them all a notification. Moments later 6 chat_summary emails were sent out to their respective test email addresses.

I’m not sure what else to check. I’ve had a dig around in the code, but my code-deciphering skills aren’t great. :slightly_smiling_face: I’ll have another think.


Thanks for mentioning that. :+1: I’ve raised it with the Team. :slightly_smiling_face:

2 Likes

Thanks.
Without having much expertise myself, users_with_unprocessed_unread_mentions in lib/chat_mailer.rb does not seem to be pulling all the users to be emailed?

Would someone have a way to validate this…

@JammyDodger
Updated title to reflect the actual issue.
Any other tests you can suggest please?
Should I tag this a bug or would you see any other tests to recreate?

I don’t think we have a clear reproduction yet.

My understanding is that @JammyDodger is trying to reproduce this issue based on your report, but has so far been unsuccessful.

A few notes:

To clarify, this is not a channel-wide setting, but a user preference for that channel. But what you’re showing are the defaults, so I’d suspect that most of the 313 members have it set that way.

Are you sure they were away? If they were on the site, then the notification will not send an email.

OK, that’s pretty strong evidence that something isn’t working as expected here. I would have guessed that more than 2 out of 313 people would be away. Is is possible that they were all on the site at that time?

2 Likes

Thanks for the clarification. I had actually thought these were channel settings admin could change. Tbh, ‘Settings’ sounds so much like an admin control.

Yes, it is safe to say the bulk of them (if not all) were away in the preceding 15 minutes (I wish we had that kind of engagement :blush: ). I picked a non-staff account that was away and checked too.

1 Like

I think I have managed to replicate this. :slightly_smiling_face: :raised_hand:

I couldn’t on my existing test site, but wondered if it was because I had already done/changed/tweaked something previously that may have affected it, so I spun up a new one and tried it on that.

  • Created fresh site
  • Enabled chat, and added everyone to chat_allowed_groups (alongside staff)
  • Signed up and logged in three test users, auto-enrolled them in ~general channel (and made one admin). Logged them all out.
  • Made a cup of tea
  • As main admin, ensured they were members of the channel and pinged them with @all

  • All received notifications
  • Only the admin user was sent an email about it

5 Likes

@JammyDodger - Did you change the value of the chat allowed groups setting? if it’s set to only staff, that would explain why only the admin was emailed.

I enabled chat, and added everyone at the same time. :+1: (sorry, I missed it out of the step-by-step. I’ll add it in now)

I think I’ve clocked it @Roman_Rizzi . :raised_hand: If I add everyone to chat_allowed_groups, everyone gets to access chat and receive notifications, but doesn’t get the @all emails. However, if I add trust_level_0 then the non-staff test-users get emails about the @all mentions.

6 Likes

Wow, what an investigation! :clap:

I checked and have staff, everyone in chat allowed groups on my site.

4 Likes

Thanks @JammyDodger :tada:

We need to handle the everyone case differently because it’s not like other groups. I have a fix ready here:

7 Likes