mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-07 02:58:21 +00:00
fix: subscribe members added to a channel to its live feed (#31113)
A user added to an existing group or DM channel saw nothing from it until they reloaded the page: the channel did not appear in their sidebar, and opening it by URL showed the history but no new messages, edits, pins or reactions. Adding members now does what channel creation already does for its participants: the newly inserted members get a `channel:created` event so their sidebar refreshes, and their open sessions join the channel room so live updates reach them. Standard channels are skipped because their access comes from access grants, matching the membership-removal path. Verified against a running server with two live Socket.IO clients: the added user's open session now gets the sidebar refresh and the next message immediately; re-adding an existing member, removal and standard channels behave as before. Fixes #30432
This commit is contained in:
parent
d8177c4177
commit
5e1f4d8c33
1 changed files with 8 additions and 0 deletions
|
|
@ -649,6 +649,14 @@ async def add_members_by_id(
|
|||
memberships = await Channels.add_members_to_channel(
|
||||
channel.id, user.id, form_data.user_ids, form_data.group_ids, db=db
|
||||
)
|
||||
if channel.type in ['group', 'dm']:
|
||||
participant_ids = [member.user_id for member in memberships]
|
||||
await emit_to_users(
|
||||
'events:channel',
|
||||
{'data': {'type': 'channel:created'}},
|
||||
participant_ids,
|
||||
)
|
||||
await enter_room_for_users(f'channel:{channel.id}', participant_ids)
|
||||
|
||||
await publish_event(
|
||||
request,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue