# Group Private Message - Message Bus Issue

**URL:** https://meta.discourse.org/t/group-private-message-message-bus-issue/181009
**Category:** Bug
**Created:** [February 24, 2021, 2:51pm UTC](https://meta.discourse.org/t/group-private-message-message-bus-issue/181009 "2021-02-24T14:51:25Z")
**Posts on this page:** 9
**Page:** 1

<div class="post-metadata">

### Author: ![danjw](https://avatars.discourse-cdn.com/v4/letter/d/a5b964/32.png) [@danjw](https://meta.discourse.org/u/danjw)
#### Post date: [February 24, 2021, 2:51pm UTC](https://meta.discourse.org/t/group-private-message-message-bus-issue/181009/1 "2021-02-24T14:51:25Z")

</div>

**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: [discourse/app/models/post.rb at b7b81afe553a79f58f79f49a6c2ceff831aa4ec7 · discourse/discourse · GitHub](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?

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [February 25, 2021, 12:46am UTC](https://meta.discourse.org/t/group-private-message-message-bus-issue/181009/2 "2021-02-25T00:46:14Z")

</div>

Definitely feels like support to me vs a bug.

Start backwards, do everything in the UI.

Does it work?

Eg:

- user1 is a member of group A
- message sent to group A
- user1 looks at the message
- user2 posts on the message
- Do you see the reply come in live?

If you do, then something about how you are consuming the API is not right.

---

<div class="post-metadata">

### Author: ![danjw](https://avatars.discourse-cdn.com/v4/letter/d/a5b964/32.png) [@danjw](https://meta.discourse.org/u/danjw)
#### Post date: [February 25, 2021, 8:32am UTC](https://meta.discourse.org/t/group-private-message-message-bus-issue/181009/3 "2021-02-25T08:32:10Z")

</div>

Thanks for the response Sam.

We’ve tested this from within the Discourse UI and it exhibits the same erroneous behaviour - i.e. the reply does not come through in realtime, only a notification/notification alert come through.

A page refresh is then required to see the latest post.

In your example above, if user1 is an admin then everything works as expected however.

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [February 25, 2021, 9:20am UTC](https://meta.discourse.org/t/group-private-message-message-bus-issue/181009/4 "2021-02-25T09:20:07Z")

</div>

Well this certainly sounds like a bug then, we will test, may take a few days.

---

<div class="post-metadata">

### Author: ![danjw](https://avatars.discourse-cdn.com/v4/letter/d/a5b964/32.png) [@danjw](https://meta.discourse.org/u/danjw)
#### Post date: [February 25, 2021, 1:38pm UTC](https://meta.discourse.org/t/group-private-message-message-bus-issue/181009/5 "2021-02-25T13:38:10Z")

</div>

Brilliant - thanks! Let me know if you need any further information

---

<div class="post-metadata">

### Author: ![danjw](https://avatars.discourse-cdn.com/v4/letter/d/a5b964/32.png) [@danjw](https://meta.discourse.org/u/danjw)
#### Post date: [March 12, 2021, 11:52am UTC](https://meta.discourse.org/t/group-private-message-message-bus-issue/181009/8 "2021-03-12T11:52:05Z")

</div>

Hi Sam - just dropping a comment to see if there’s anywhere where I can keep tabs on any progress for this bug? Not completely clued up on the bug reporting/fixing process with Discourse - Thanks!

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [March 12, 2021, 12:28pm UTC](https://meta.discourse.org/t/group-private-message-message-bus-issue/181009/9 "2021-03-12T12:28:03Z")

</div>

I am pretty sure kris fixed it, recommend you re test

---

<div class="post-metadata">

### Author: ![kris.kotlarek](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/kris.kotlarek/32/176919_2.png) [@kris.kotlarek](https://meta.discourse.org/u/kris.kotlarek)
#### Post date: [March 15, 2021, 5:01am UTC](https://meta.discourse.org/t/group-private-message-message-bus-issue/181009/10 "2021-03-15T05:01:02Z")

</div>

Hey @danjw,

sorry, I forgot to let you know. Sam is right, it was fixed with PR below:

[https://github.com/discourse/discourse/pull/12269](https://github.com/discourse/discourse/pull/12269)

---

<div class="post-metadata">

### Author: ![sam](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/sam/32/102149_2.png) [@sam](https://meta.discourse.org/u/sam)
#### Post date: [March 15, 2021, 5:01am UTC](https://meta.discourse.org/t/group-private-message-message-bus-issue/181009/11 "2021-03-15T05:01:40Z")

</div>


