diff --git a/src/lib/components/admin/Settings/Models/ManageModelsModal.svelte b/src/lib/components/admin/Settings/Models/ManageModelsModal.svelte
index 6b53952e1..117009dda 100644
--- a/src/lib/components/admin/Settings/Models/ManageModelsModal.svelte
+++ b/src/lib/components/admin/Settings/Models/ManageModelsModal.svelte
@@ -19,7 +19,7 @@
let ollamaConfig = null;
onMount(async () => {
- if ($user.role === 'admin') {
+ if ($user?.role === 'admin') {
await Promise.all([
(async () => {
ollamaConfig = await getOllamaConfig(localStorage.token);
diff --git a/src/lib/components/channel/Channel.svelte b/src/lib/components/channel/Channel.svelte
index 275f76d29..ce2aa54f1 100644
--- a/src/lib/components/channel/Channel.svelte
+++ b/src/lib/components/channel/Channel.svelte
@@ -106,7 +106,7 @@
messages[idx] = data;
}
} else if (type === 'typing' && event.message_id === null) {
- if (event.user.id === $user.id) {
+ if (event.user.id === $user?.id) {
return;
}
diff --git a/src/lib/components/channel/Messages.svelte b/src/lib/components/channel/Messages.svelte
index f8ff2f229..e1bc326b3 100644
--- a/src/lib/components/channel/Messages.svelte
+++ b/src/lib/components/channel/Messages.svelte
@@ -132,7 +132,7 @@
if (
(message?.reactions ?? [])
.find((reaction) => reaction.name === name)
- ?.user_ids?.includes($user.id) ??
+ ?.user_ids?.includes($user?.id) ??
false
) {
messages = messages.map((m) => {
@@ -140,7 +140,7 @@
const reaction = m.reactions.find((reaction) => reaction.name === name);
if (reaction) {
- reaction.user_ids = reaction.user_ids.filter((id) => id !== $user.id);
+ reaction.user_ids = reaction.user_ids.filter((id) => id !== $user?.id);
reaction.count = reaction.user_ids.length;
if (reaction.count === 0) {
@@ -167,12 +167,12 @@
const reaction = m.reactions.find((reaction) => reaction.name === name);
if (reaction) {
- reaction.user_ids.push($user.id);
+ reaction.user_ids.push($user?.id);
reaction.count = reaction.user_ids.length;
} else {
m.reactions.push({
name: name,
- user_ids: [$user.id],
+ user_ids: [$user?.id],
count: 1
});
}
diff --git a/src/lib/components/channel/Messages/Message.svelte b/src/lib/components/channel/Messages/Message.svelte
index 0736a2512..998938806 100644
--- a/src/lib/components/channel/Messages/Message.svelte
+++ b/src/lib/components/channel/Messages/Message.svelte
@@ -106,7 +106,7 @@
{/if}
- {#if message.user_id === $user.id || $user.role === 'admin'}
+ {#if message.user_id === $user?.id || $user?.role === 'admin'}
- {#if $user.role === 'admin' || $user?.permissions.chat?.controls}
+ {#if $user?.role === 'admin' || $user?.permissions.chat?.controls}