mirror of
https://github.com/open-webui/open-webui.git
synced 2025-12-16 11:57:51 +01:00
fix: user channels issue
This commit is contained in:
@@ -182,12 +182,18 @@
|
||||
|
||||
const initChannels = async () => {
|
||||
// default (none), group, dm type
|
||||
const res = await getChannels(localStorage.token).catch((error) => {
|
||||
return null;
|
||||
});
|
||||
|
||||
if (res) {
|
||||
await channels.set(
|
||||
(await getChannels(localStorage.token)).sort(
|
||||
res.sort(
|
||||
(a, b) =>
|
||||
['', null, 'group', 'dm'].indexOf(a.type) - ['', null, 'group', 'dm'].indexOf(b.type)
|
||||
)
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
const initChatList = async () => {
|
||||
|
||||
@@ -487,12 +487,19 @@
|
||||
|
||||
// handle channel created event
|
||||
if (event.data?.type === 'channel:created') {
|
||||
const res = await getChannels(localStorage.token).catch(async (error) => {
|
||||
return null;
|
||||
});
|
||||
|
||||
if (res) {
|
||||
await channels.set(
|
||||
(await getChannels(localStorage.token)).sort(
|
||||
res.sort(
|
||||
(a, b) =>
|
||||
['', null, 'group', 'dm'].indexOf(a.type) - ['', null, 'group', 'dm'].indexOf(b.type)
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -531,8 +538,13 @@
|
||||
})
|
||||
);
|
||||
} else {
|
||||
const res = await getChannels(localStorage.token).catch(async (error) => {
|
||||
return null;
|
||||
});
|
||||
|
||||
if (res) {
|
||||
await channels.set(
|
||||
(await getChannels(localStorage.token)).sort(
|
||||
res.sort(
|
||||
(a, b) =>
|
||||
['', null, 'group', 'dm'].indexOf(a.type) -
|
||||
['', null, 'group', 'dm'].indexOf(b.type)
|
||||
@@ -540,6 +552,7 @@
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (type === 'message') {
|
||||
const title = `${data?.user?.name}${event?.channel?.type !== 'dm' ? ` (#${event?.channel?.name})` : ''}`;
|
||||
|
||||
Reference in New Issue
Block a user