auth: rename profile.data -> profile.current
This commit is contained in:
76 files changed
+233
-224
No files matched your search
@@ -86,7 +86,7 @@
|
||||
style="border-radius: inherit;"
|
||||
>
|
||||
<div class="ml-auto"></div>
|
||||
{#if profile.data?.user && isAdmin(profile.data.user)}
|
||||
{#if profile.current?.user && isAdmin(profile.current.user)}
|
||||
<NavButton
|
||||
href="/admin"
|
||||
label={$t('nav.admin')}
|
||||
@@ -95,7 +95,7 @@
|
||||
isSelectedFilter={path => path.startsWith('/admin')}
|
||||
/>
|
||||
{/if}
|
||||
{#if amModOfAny(profile.data?.user)}
|
||||
{#if amModOfAny(profile.current?.user)}
|
||||
<NavButton
|
||||
href="/moderation"
|
||||
label={$t('nav.moderation')}
|
||||
@@ -109,10 +109,10 @@
|
||||
icon={GlobeAlt}
|
||||
/>
|
||||
<NavButton href="/search" label={$t('nav.search')} icon={MagnifyingGlass} />
|
||||
{#if profile.data.jwt}
|
||||
{#if profile.current.jwt}
|
||||
{@const linkOnly =
|
||||
!profile.data.user ||
|
||||
!(isAdmin(profile.data.user) || amModOfAny(profile.data.user))}
|
||||
!profile.current.user ||
|
||||
!(isAdmin(profile.current.user) || amModOfAny(profile.current.user))}
|
||||
<Menu manual={linkOnly} placement="top">
|
||||
{#snippet target()}
|
||||
<NavButton
|
||||
@@ -136,7 +136,7 @@
|
||||
{@render notifBadge($notifications.inbox)}
|
||||
{/snippet}
|
||||
</MenuButton>
|
||||
{#if amModOfAny(profile.data.user)}
|
||||
{#if amModOfAny(profile.current.user)}
|
||||
<MenuButton href="/moderation" icon={ShieldCheck}>
|
||||
{$t('routes.moderation.feed')}
|
||||
{#snippet suffix()}
|
||||
@@ -144,7 +144,7 @@
|
||||
{/snippet}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
{#if profile.data.user && isAdmin(profile.data.user)}
|
||||
{#if profile.current.user && isAdmin(profile.current.user)}
|
||||
<MenuButton href="/admin/applications" icon={ServerStack}>
|
||||
{$t('routes.admin.applications.title')}
|
||||
{#snippet suffix()}
|
||||
@@ -156,7 +156,7 @@
|
||||
{/if}
|
||||
<Menu
|
||||
manual={site.data?.site_view.local_site.community_creation_admin_only &&
|
||||
!(profile.data.user && isAdmin(profile.data.user))}
|
||||
!(profile.current.user && isAdmin(profile.current.user))}
|
||||
placement="top"
|
||||
>
|
||||
{#snippet target()}
|
||||
@@ -166,13 +166,13 @@
|
||||
icon={Plus}
|
||||
adaptive={false}
|
||||
href={site.data?.site_view.local_site.community_creation_admin_only &&
|
||||
!(profile.data.user && isAdmin(profile.data.user))
|
||||
!(profile.current.user && isAdmin(profile.current.user))
|
||||
? '/create/post'
|
||||
: undefined}
|
||||
/>
|
||||
{/snippet}
|
||||
<MenuDivider>{$t('nav.create.label')}</MenuDivider>
|
||||
<MenuButton link href="/create/post" disabled={!profile.data?.jwt}>
|
||||
<MenuButton link href="/create/post" disabled={!profile.current?.jwt}>
|
||||
{#snippet prefix()}
|
||||
<Icon src={PencilSquare} size="16" micro />
|
||||
{/snippet}
|
||||
@@ -181,17 +181,17 @@
|
||||
<MenuButton
|
||||
link
|
||||
href="/create/community"
|
||||
disabled={!profile.data?.jwt ||
|
||||
!profile.data?.user ||
|
||||
disabled={!profile.current?.jwt ||
|
||||
!profile.current?.user ||
|
||||
(site.data?.site_view.local_site.community_creation_admin_only &&
|
||||
!isAdmin(profile.data.user))}
|
||||
!isAdmin(profile.current.user))}
|
||||
>
|
||||
{#snippet prefix()}
|
||||
<Icon src={Newspaper} size="16" micro />
|
||||
{/snippet}
|
||||
{$t('nav.create.community')}
|
||||
</MenuButton>
|
||||
{#if !profile.data?.jwt}
|
||||
{#if !profile.current?.jwt}
|
||||
<span class="text-sm mx-4 my-1 py-1">
|
||||
{$t('nav.create.logingate')}
|
||||
</span>
|
||||
|
||||
@@ -72,14 +72,14 @@
|
||||
hover:bg-slate-200 dark:hover:bg-zinc-700 group cursor-pointer {buttonClass}"
|
||||
title={$t('profile.profile')}
|
||||
>
|
||||
{#if profile.data?.user}
|
||||
{#if profile.current?.user}
|
||||
<div
|
||||
class="w-full h-full aspect-square object-cover rounded-full grid place-items-center group-hover:scale-90 transition-transform group-active:scale-[85%]"
|
||||
>
|
||||
<Avatar
|
||||
url={profile.data.user.local_user_view.person.avatar}
|
||||
url={profile.current.user.local_user_view.person.avatar}
|
||||
width={36}
|
||||
alt={profile.data.user.local_user_view.person.name}
|
||||
alt={profile.current.user.local_user_view.person.name}
|
||||
/>
|
||||
</div>
|
||||
{:else}
|
||||
@@ -90,7 +90,7 @@
|
||||
</button>
|
||||
{/snippet}
|
||||
<MenuDivider>{$t('nav.menu.label')}</MenuDivider>
|
||||
{#if profile.data?.jwt}
|
||||
{#if profile.current?.jwt}
|
||||
<MenuButton href="/profile">
|
||||
{#snippet prefix()}
|
||||
<Icon src={UserCircle} micro size="16" />
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
$effect(() => {
|
||||
groups = getGroups(
|
||||
$resumables,
|
||||
profile.data,
|
||||
profile.current,
|
||||
profileData.profiles,
|
||||
theme.data,
|
||||
page.data.contextual?.actions,
|
||||
|
||||
@@ -25,7 +25,7 @@
|
||||
animate:flip={{ duration: 500, easing: expoOut }}
|
||||
>
|
||||
<div class="flex-none grid group">
|
||||
{#if profile && !hasFavorite(profile.data, follow.id)}
|
||||
{#if profile && !hasFavorite(profile.current, follow.id)}
|
||||
<Button
|
||||
rounding="pill"
|
||||
size="custom"
|
||||
@@ -36,7 +36,7 @@
|
||||
>
|
||||
<Icon src={Star} size="16" mini />
|
||||
</Button>
|
||||
{:else if isFavorites && profile && hasFavorite(profile.data, follow.id)}
|
||||
{:else if isFavorites && profile && hasFavorite(profile.current, follow.id)}
|
||||
<Button
|
||||
rounding="pill"
|
||||
size="custom"
|
||||
@@ -53,7 +53,9 @@
|
||||
alt={follow.name}
|
||||
title={follow.title}
|
||||
width={28}
|
||||
class={!isFavorites && profile && hasFavorite(profile.data, follow.id)
|
||||
class={!isFavorites &&
|
||||
profile &&
|
||||
hasFavorite(profile.current, follow.id)
|
||||
? ''
|
||||
: 'group-hover:hidden'}
|
||||
/>
|
||||
|
||||
@@ -23,11 +23,11 @@
|
||||
loading={switching}
|
||||
rounding="lg"
|
||||
loaderWidth={22}
|
||||
selected={profile.data?.id == prof.id}
|
||||
selected={profile.current?.id == prof.id}
|
||||
onclick={async () => {
|
||||
switching = true
|
||||
|
||||
if (profile.data?.id != prof.id) {
|
||||
if (profile.current?.id != prof.id) {
|
||||
await setUserID(prof.id)
|
||||
}
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
|
||||
switching = false
|
||||
}}
|
||||
class="w-full font-normal {profile.data?.id == prof.id
|
||||
class="w-full font-normal {profile.current?.id == prof.id
|
||||
? 'bg-slate-100! dark:bg-zinc-900!'
|
||||
: ''}"
|
||||
>
|
||||
@@ -46,11 +46,11 @@
|
||||
profile={prof}
|
||||
{index}
|
||||
{guest}
|
||||
selected={profile.data?.id == prof.id}
|
||||
selected={profile.current?.id == prof.id}
|
||||
/>
|
||||
{/snippet}
|
||||
<span
|
||||
class="inline-flex flex-col gap-0 {profile.data?.id == prof.id
|
||||
class="inline-flex flex-col gap-0 {profile.current?.id == prof.id
|
||||
? 'font-semibold'
|
||||
: ''}"
|
||||
>
|
||||
|
||||
@@ -31,7 +31,7 @@
|
||||
class={['flex flex-col p-4 overflow-auto gap-1 h-fit max-h-screen', clazz]}
|
||||
{style}
|
||||
>
|
||||
{#if profile.data?.jwt}
|
||||
{#if profile.current?.jwt}
|
||||
<SidebarButton icon={UserCircle} href="/profile">
|
||||
{#snippet label()}
|
||||
<span>
|
||||
@@ -120,7 +120,7 @@
|
||||
</Expandable>
|
||||
{/if}
|
||||
<hr class="border-slate-200 dark:border-zinc-900 my-1" />
|
||||
{#if profile.data?.favorites && profile.data?.favorites.length > 0}
|
||||
{#if profile.current?.favorites && profile.current?.favorites.length > 0}
|
||||
<Expandable
|
||||
class="max-w-full min-w-0 w-full"
|
||||
bind:open={settings.expand.favorites}
|
||||
@@ -131,18 +131,18 @@
|
||||
{$t('routes.profile.favorites')}
|
||||
{#snippet action()}
|
||||
<span class="dark:text-white text-black">
|
||||
{profile.data.favorites?.length}
|
||||
{profile.current.favorites?.length}
|
||||
</span>
|
||||
{/snippet}
|
||||
</EndPlaceholder>
|
||||
</span>
|
||||
{/snippet}
|
||||
<CommunityList isFavorites items={profile.data.favorites} />
|
||||
<CommunityList isFavorites items={profile.current.favorites} />
|
||||
</Expandable>
|
||||
<hr class="border-slate-200 dark:border-zinc-900 my-1" />
|
||||
{/if}
|
||||
{#if profile.data?.user}
|
||||
{#if profile.data?.user.moderates.length > 0}
|
||||
{#if profile.current?.user}
|
||||
{#if profile.current?.user.moderates.length > 0}
|
||||
<Expandable
|
||||
class="max-w-full min-w-0 w-full"
|
||||
bind:open={settings.expand.moderates}
|
||||
@@ -153,14 +153,14 @@
|
||||
{$t('routes.profile.moderates')}
|
||||
{#snippet action()}
|
||||
<span class="dark:text-white text-black">
|
||||
{profile.data.user?.moderates.length}
|
||||
{profile.current.user?.moderates.length}
|
||||
</span>
|
||||
{/snippet}
|
||||
</EndPlaceholder>
|
||||
</span>
|
||||
{/snippet}
|
||||
<CommunityList
|
||||
items={profile.data.user.moderates.map(i => i.community)}
|
||||
items={profile.current.user.moderates.map(i => i.community)}
|
||||
/>
|
||||
</Expandable>
|
||||
<hr class="border-slate-200 dark:border-zinc-900 my-1" />
|
||||
@@ -176,13 +176,15 @@
|
||||
{$t('profile.subscribed')}
|
||||
{#snippet action()}
|
||||
<span class="dark:text-white text-black">
|
||||
{profile.data.user?.follows.length}
|
||||
{profile.current.user?.follows.length}
|
||||
</span>
|
||||
{/snippet}
|
||||
</EndPlaceholder>
|
||||
</span>
|
||||
{/snippet}
|
||||
<CommunityList items={profile.data.user.follows.map(i => i.community)} />
|
||||
<CommunityList
|
||||
items={profile.current.user.follows.map(i => i.community)}
|
||||
/>
|
||||
</Expandable>
|
||||
{/if}
|
||||
</nav>
|
||||
Reference in new issue
Block a user