mirror of
https://github.com/open-webui/open-webui
synced 2025-06-26 18:26:48 +00:00
refac: $user
This commit is contained in:
@@ -167,7 +167,7 @@
|
||||
{#if $user !== undefined}
|
||||
<UserMenu
|
||||
className="max-w-[200px]"
|
||||
role={$user.role}
|
||||
role={$user?.role}
|
||||
on:show={(e) => {
|
||||
if (e.detail === 'archived-chat') {
|
||||
showArchivedChats.set(true);
|
||||
@@ -180,7 +180,7 @@
|
||||
>
|
||||
<div class=" self-center">
|
||||
<img
|
||||
src={$user.profile_image_url}
|
||||
src={$user?.profile_image_url}
|
||||
class="size-6 object-cover rounded-full"
|
||||
alt="User profile"
|
||||
draggable="false"
|
||||
|
||||
@@ -446,7 +446,7 @@
|
||||
});
|
||||
|
||||
if (res) {
|
||||
$socket.emit('join-channels', { auth: { token: $user.token } });
|
||||
$socket.emit('join-channels', { auth: { token: $user?.token } });
|
||||
await initChannels();
|
||||
showCreateChannel = false;
|
||||
}
|
||||
@@ -627,13 +627,13 @@
|
||||
? 'opacity-20'
|
||||
: ''}"
|
||||
>
|
||||
{#if $config?.features?.enable_channels && ($user.role === 'admin' || $channels.length > 0) && !search}
|
||||
{#if $config?.features?.enable_channels && ($user?.role === 'admin' || $channels.length > 0) && !search}
|
||||
<Folder
|
||||
className="px-2 mt-0.5"
|
||||
name={$i18n.t('Channels')}
|
||||
dragAndDrop={false}
|
||||
onAdd={async () => {
|
||||
if ($user.role === 'admin') {
|
||||
if ($user?.role === 'admin') {
|
||||
await tick();
|
||||
|
||||
setTimeout(() => {
|
||||
@@ -891,9 +891,9 @@
|
||||
|
||||
<div class="px-2">
|
||||
<div class="flex flex-col font-primary">
|
||||
{#if $user !== undefined}
|
||||
{#if $user !== undefined && $user !== null}
|
||||
<UserMenu
|
||||
role={$user.role}
|
||||
role={$user?.role}
|
||||
on:show={(e) => {
|
||||
if (e.detail === 'archived-chat') {
|
||||
showArchivedChats.set(true);
|
||||
@@ -908,12 +908,12 @@
|
||||
>
|
||||
<div class=" self-center mr-3">
|
||||
<img
|
||||
src={$user.profile_image_url}
|
||||
src={$user?.profile_image_url}
|
||||
class=" max-w-[30px] object-cover rounded-full"
|
||||
alt="User profile"
|
||||
/>
|
||||
</div>
|
||||
<div class=" self-center font-medium">{$user.name}</div>
|
||||
<div class=" self-center font-medium">{$user?.name}</div>
|
||||
</button>
|
||||
</UserMenu>
|
||||
{/if}
|
||||
|
||||
Reference in New Issue
Block a user