mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-12 04:15:25 +00:00
refac
This commit is contained in:
parent
f1a7de94ba
commit
d5d0e72590
2 changed files with 6 additions and 4 deletions
|
|
@ -129,9 +129,9 @@ async def get_all_channels(user=Depends(get_verified_user)):
|
||||||
@router.post("/create", response_model=Optional[ChannelModel])
|
@router.post("/create", response_model=Optional[ChannelModel])
|
||||||
async def create_new_channel(form_data: ChannelForm, user=Depends(get_admin_user)):
|
async def create_new_channel(form_data: ChannelForm, user=Depends(get_admin_user)):
|
||||||
try:
|
try:
|
||||||
if form_data.type == "dm" and len(form_data.user_ids) == 1:
|
if form_data.type == "dm":
|
||||||
existing_channel = Channels.get_dm_channel_by_user_ids(
|
existing_channel = Channels.get_dm_channel_by_user_ids(
|
||||||
[user.id, form_data.user_ids[0]]
|
[user.id, *form_data.user_ids]
|
||||||
)
|
)
|
||||||
if existing_channel:
|
if existing_channel:
|
||||||
Channels.update_member_active_status(existing_channel.id, user.id, True)
|
Channels.update_member_active_status(existing_channel.id, user.id, True)
|
||||||
|
|
|
||||||
|
|
@ -511,9 +511,11 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
if (type === 'message') {
|
if (type === 'message') {
|
||||||
|
const title = `${data?.user?.name}${event?.channel?.type !== 'dm' ? ` (#${event?.channel?.name})` : ''}`;
|
||||||
|
|
||||||
if ($isLastActiveTab) {
|
if ($isLastActiveTab) {
|
||||||
if ($settings?.notificationEnabled ?? false) {
|
if ($settings?.notificationEnabled ?? false) {
|
||||||
new Notification(`${data?.user?.name} (#${event?.channel?.name}) • Open WebUI`, {
|
new Notification(`${title} • Open WebUI`, {
|
||||||
body: data?.content,
|
body: data?.content,
|
||||||
icon: `${WEBUI_API_BASE_URL}/users/${data?.user?.id}/profile/image`
|
icon: `${WEBUI_API_BASE_URL}/users/${data?.user?.id}/profile/image`
|
||||||
});
|
});
|
||||||
|
|
@ -526,7 +528,7 @@
|
||||||
goto(`/channels/${event.channel_id}`);
|
goto(`/channels/${event.channel_id}`);
|
||||||
},
|
},
|
||||||
content: data?.content,
|
content: data?.content,
|
||||||
title: `#${event?.channel?.name}`
|
title: `${title}`
|
||||||
},
|
},
|
||||||
duration: 15000,
|
duration: 15000,
|
||||||
unstyled: true
|
unstyled: true
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue