Group Private Message - Message Bus Issue

Context
We have a system whereby we programmatically add users to groups, via the API, and automatically create private messages for individual groups, all via the API.

For example, we might have a group called: cooking-class-101

For which we’ll create a private message with cooking-class-101 & system as 2 participants in the private message.

This has worked really well for us as a way of automatically creating private group chats for groups of people.

The Problem
The issue we’re seeing is that for regular users who are part of the group, the message bus does not return any updates when new posts are added to the topic.

For example, we have a group private message with topic ID 123. We can see that the message bus is subscribed to the channel topic/123, yet if another user creates a post on the topic, nothing is returned by the message bus and therefore the latest post does not automatically show.

We have confirmed that the message bus is generally working as expected as it does correctly return data on the topic/presence/123 channel.

The counter to the above is that for admin users who are part of the group that has been added to the private message, the message bus does correctly return data on the topic/123 channel and the new post is therefore correctly shown on the topic in real time.

We’ve also confirmed that if a regular user who is a member of the group is separately invited to participate in the topic (so now we have cooking-class-101, system & regular-user participating), then they start to correctly receive responses from the message bus on the topic/123 channel and therefore see new posts in real time.

Research
Digging around in the Discourse code brings me to the following which looks as though for private message topics, it might not be notifying groups of new posts being published: https://github.com/discourse/discourse/blob/b7b81afe553a79f58f79f49a6c2ceff831aa4ec7/app/models/post.rb#L214-L219

I’m not entirely sure what topic.allowed_users in the link above is supposed to return on a private message topic with a group added to it, but my suspicion is that it doesn’t include the list of users who exist as part of the group.

I’ve tagged this as a bug, but this may well be intended behaviour?

2 Likes