fix: no channel message webhooks from group channels and direct messages (#32404)

Users with a notification webhook for channel messages received no webhook when someone posted in a group channel or direct message they belong to. Only regular channels they had been given access to sent it. Members of group channels and direct messages now get the webhook too, and muting one of these channels stops the webhook except for messages that mention them.

Fixes #32403
This commit is contained in:
Classic298 authored and GitHub committed 2026-10-14 17:16:22 +04:00
1 parent c314239558
commit 3b2b89205e
1 file changed
+4 -2
+4 -2
View File
@@ -1098,10 +1098,12 @@ async def send_notification(request, channel, message, active_user_ids, db=None)
webui_url = await Config.get('webui.url')
enable_user_webhooks = await Config.get('ui.enable_user_webhooks')
users = await get_channel_users_with_access(channel, 'read', db=db)
# Batch fetch channel members in 1 query (fixes N+1)
members = {m.user_id: m for m in await Channels.get_members_by_channel_id(channel.id, db=db)}
if channel.type in ['group', 'dm']:
users = await Users.get_users_by_user_ids(list(members), db=db)
else:
users = await get_channel_users_with_access(channel, 'read', db=db)
mentioned_user_ids = {m['id'] for m in extract_mentions(message.content) if m['id_type'] == 'U'}
url = f'{webui_url}/channels/{channel.id}'