mirror of
https://github.com/open-webui/open-webui.git
synced 2026-10-05 02:41:34 +00:00
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:
parent
9d2c3965ff
commit
69f64c9844
1 changed files with 6 additions and 2 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue