refac
This commit is contained in:
1 parent
48a5696042
commit
3c010951db
1 file changed
+17
-11
@@ -403,6 +403,18 @@
|
|||||||
]);
|
]);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const initSidebarData = async () => {
|
||||||
|
// Only fetch channels if the feature is enabled and user has permission
|
||||||
|
if (
|
||||||
|
$config?.features?.enable_channels &&
|
||||||
|
($user?.role === 'admin' || ($user?.permissions?.features?.channels ?? true))
|
||||||
|
) {
|
||||||
|
await initChannels();
|
||||||
|
}
|
||||||
|
|
||||||
|
await initChatList();
|
||||||
|
};
|
||||||
|
|
||||||
const refreshChatRows = async () => {
|
const refreshChatRows = async () => {
|
||||||
const result = await refreshChatList(localStorage.token, { refreshPinned: true });
|
const result = await refreshChatList(localStorage.token, { refreshPinned: true });
|
||||||
if (result.accepted) {
|
if (result.accepted) {
|
||||||
@@ -414,6 +426,10 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
const loadMoreChats = async () => {
|
const loadMoreChats = async () => {
|
||||||
|
if (chatListLoading || allChatsLoaded || !$showSidebar) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
chatListLoading = true;
|
chatListLoading = true;
|
||||||
|
|
||||||
const result = await loadNextChatListPage(localStorage.token);
|
const result = await loadNextChatListPage(localStorage.token);
|
||||||
@@ -661,17 +677,6 @@
|
|||||||
navElement.style['-webkit-app-region'] = 'drag';
|
navElement.style['-webkit-app-region'] = 'drag';
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (value) {
|
|
||||||
// Only fetch channels if the feature is enabled and user has permission
|
|
||||||
if (
|
|
||||||
$config?.features?.enable_channels &&
|
|
||||||
($user?.role === 'admin' || ($user?.permissions?.features?.channels ?? true))
|
|
||||||
) {
|
|
||||||
await initChannels();
|
|
||||||
}
|
|
||||||
await initChatList();
|
|
||||||
}
|
|
||||||
}),
|
}),
|
||||||
settings.subscribe((value) => {
|
settings.subscribe((value) => {
|
||||||
if (pinnedModels != value?.pinnedModels ?? []) {
|
if (pinnedModels != value?.pinnedModels ?? []) {
|
||||||
@@ -711,6 +716,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
await tick();
|
await tick();
|
||||||
|
await initSidebarData();
|
||||||
initPinnedMenuSortable();
|
initPinnedMenuSortable();
|
||||||
|
|
||||||
return () => {
|
return () => {
|
||||||
|
|||||||
Reference in new issue
Block a user