Bulk adding members to a group is broken

AI-generated summary

A bug was reported where bulk adding members to a custom group does not update the group’s member count or functionality, despite appearing to succeed. HAWK demonstrated that while the upload seems successful, the group acts as if it has no members, and group tagging in posts does not work. techAPJ confirmed the issue was due to the lack of immediate group user count updates during bulk adds, which are normally updated every 12 hours. The issue was further clarified as a regression in group mentions, where notifications were sent but the visual display was confusing. techAPJ fixed the problem by adding code to update the group user count immediately during bulk adds, with the fix committed to Discourse’s codebase here.

I’ve come across a bug with bulk adding members to a custom group. I can repro it on try.

Repro steps:

  1. Create a new custom group
  2. Bulk add (58)users to group using username
  3. The upload appears to work: https://try.discourse.org/groups/Experienced

But group appears to have (and acts as if it has) no members

Manually joining the group causes this to happen:

But leaving then causes this:

I thought it was related to this but it’s not just the count – the functionality (i.e. tagging the group) doesn’t work.

3 Likes

Hmm can you take a look @techAPJ and see if you can repro too?

4 Likes

This is indeed because we do not update group user count when bulk adding users. The count is updated every 12 hours in EnsureDbConsistency job.

Does that mean mentioning the group in topics/posts is broken? It is working for me on try for that group.

3 Likes

Is it actually working though? I get this (and it’s the same on my other site even after 24 hours and the count has updated):

1 Like

Interesting, this might be a regression in mentioning groups. I’ll look into it today.

2 Likes

The mention notifications were getting sent, but looking at that warning I agree that this looks very confusing to end user.

I added the code to update group user count when bulk adding users to a group.

https://github.com/discourse/discourse/commit/709f201bd4a7d6e1e02a1d84cf035d0628b31c50

5 Likes