refac: $user

This commit is contained in:
Timothy Jaeryang Baek
2025-03-31 20:32:12 -07:00
parent 1b7c125f00
commit e0ec2cdeb0
27 changed files with 57 additions and 57 deletions

View File

@@ -31,8 +31,8 @@
let profileImageInputElement: HTMLInputElement;
const submitHandler = async () => {
if (name !== $user.name) {
if (profileImageUrl === generateInitialsImage($user.name) || profileImageUrl === '') {
if (name !== $user?.name) {
if (profileImageUrl === generateInitialsImage($user?.name) || profileImageUrl === '') {
profileImageUrl = generateInitialsImage(name);
}
}
@@ -75,8 +75,8 @@
};
onMount(async () => {
name = $user.name;
profileImageUrl = $user.profile_image_url;
name = $user?.name;
profileImageUrl = $user?.profile_image_url;
webhookUrl = $settings?.notifications?.webhook_url ?? '';
APIKey = await getAPIKey(localStorage.token).catch((error) => {
@@ -214,7 +214,7 @@
<button
class=" text-xs text-center text-gray-800 dark:text-gray-400 rounded-full px-4 py-0.5 bg-gray-100 dark:bg-gray-850"
on:click={async () => {
const url = await getGravatarUrl(localStorage.token, $user.email);
const url = await getGravatarUrl(localStorage.token, $user?.email);
profileImageUrl = url;
}}>{$i18n.t('Use Gravatar')}</button

View File

@@ -308,7 +308,7 @@
</div>
</div>
{#if $user.role === 'admin' || $user?.permissions.chat?.controls}
{#if $user?.role === 'admin' || $user?.permissions.chat?.controls}
<hr class="border-gray-100 dark:border-gray-850 my-3" />
<div>

View File

@@ -441,7 +441,7 @@
</div>
</div>
{#if $user.role === 'admin'}
{#if $user?.role === 'admin'}
<div>
<div class=" py-0.5 flex w-full justify-between">
<div class=" self-center text-xs">