fix: channel mention notification shows raw mention markup with the user id (#31601)

When someone mentioned a user or channel in a channel message, the notification toast and the browser notification showed the raw mention markup, including the internal id. They now show the mention the same way the message does in the channel, for example "@Alex".

Fixes #31586
This commit is contained in:
Classic298 authored and GitHub committed 2026-09-30 20:13:37 +04:00
1 parent 9d2c3965ff
commit 69f64c9844
1 file changed
+6 -2
+6 -2
View File
@@ -882,6 +882,10 @@
if (type === 'message') {
const title = `${data?.user?.name}${event?.channel?.type !== 'dm' ? ` (#${event?.channel?.name})` : ''}`;
const content = data?.content?.replace(
/<([@#])([^|>\s]+)(?:\|([^>]*))?>/g,
(_, trigger, id, label) => trigger + (label || id)
);
if ($isLastActiveTab) {
if ($settings?.notificationEnabled ?? false) {
@@ -889,7 +893,7 @@
// Do not alter, remove, obscure, or replace it except as LICENSE permits:
// https://docs.openwebui.com/license.
new Notification(`${title} / Open WebUI`, {
body: data?.content,
body: content,
icon: `${WEBUI_API_BASE_URL}/users/${data?.user?.id}/profile/image`
});
}
@@ -902,7 +906,7 @@
`/channels/${event.channel_id}${data?.parent_id ? `?thread=${data.parent_id}` : ''}`
);
},
content: data?.content,
content,
title: `${title}`
},
duration: 15000,