Websocket events recipients for create_channel and user_added

Not sure if this is a bug or intentional and I should file a feature request. We use mattermost-server with custom frontend and when user creates channel, we add all team members to it and want to refresh the UI for the others so they see the new channel automatically. The issue is that the websocket events are sent to recipients which do not benefit much from it.

For channel_created event the recipient is the user who created the channel https://github.com/mattermost/mattermost-server/blob/master/app/channel.go#L156. I would expect this to go to the team under which the channel was created to show a notification about new channel to all the team members.

Event user_added on the other hand goes only to the channel in question https://github.com/mattermost/mattermost-server/blob/master/app/channel.go#L831 but not to the user being added to the channel, so again there is no notification that the user added to channel can act upon.

So is this expected behaviour? Are there some other events I could use to reliably notify user about new channel in his team or that he was added to channel?

Hi @aocenas,

The first case (channel created) would be a feature request.

The second case (user added) should work. What Mattermost server version are you currently using?

Hi @amy.blais

I tried it with 5.5.1 version and also latest master. The relevant code for sending user_added is here https://github.com/mattermost/mattermost-server/blame/ce2c7110d3db836790f90fc63968b68f14a9f516/app/channel.go#L831 and based on blame it seems it did not change in 2 years and as you can see only ‘channel.Id’ is filled there for the event broadcast. I did not find any other usage of the WEBSOCKET_EVENT_USER_ADDED event in the code. Is it possible there is some other event I should be looking for?

Hi @aocenas,

A response from one of our community members: The added user should see a post with type model.POST_ADD_TO_CHANNEL - see https://github.com/mattermost/mattermost-server/blob/v5.7.0/app/channel.go#L1375.