auth: update profile class to contain profileData as well
This commit is contained in:
13 files changed
+238
-265
No files matched your search
@@ -2,7 +2,7 @@
|
||||
import { browser } from '$app/environment'
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/state'
|
||||
import { profile, profileData } from '$lib/auth.svelte'
|
||||
import { profile } from '$lib/auth.svelte'
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { resumables } from '$lib/lemmy/item'
|
||||
import { theme } from '$lib/ui/colors.svelte'
|
||||
@@ -24,7 +24,7 @@
|
||||
groups = getGroups(
|
||||
$resumables,
|
||||
profile.current,
|
||||
profileData.profiles,
|
||||
profile.meta.profiles,
|
||||
theme.data,
|
||||
page.data.contextual?.actions,
|
||||
)
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/state'
|
||||
import { setUserID, type Profile } from '$lib/auth.svelte'
|
||||
import { profile as currentProfile, type ProfileInfo } from '$lib/auth.svelte'
|
||||
import {
|
||||
amModOfAny,
|
||||
isAdmin,
|
||||
@@ -64,8 +64,8 @@ export interface Action {
|
||||
|
||||
export function getGroups(
|
||||
resumables: ResumableItem[],
|
||||
profile: Profile,
|
||||
profiles: Profile[],
|
||||
profile: ProfileInfo,
|
||||
profiles: ProfileInfo[],
|
||||
td: ThemeData,
|
||||
contextual?: Action[],
|
||||
) {
|
||||
@@ -311,7 +311,7 @@ export function getGroups(
|
||||
detail: p.instance,
|
||||
handle: async () => {
|
||||
if (profile.id != p.id) {
|
||||
await setUserID(p.id)
|
||||
currentProfile.meta.profile = p.id
|
||||
}
|
||||
|
||||
await goto(page.url, {
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<script lang="ts">
|
||||
import { goto } from '$app/navigation'
|
||||
import { page } from '$app/state'
|
||||
import { profile, setUserID, type Profile } from '$lib/auth.svelte.js'
|
||||
import { profile, type ProfileInfo } from '$lib/auth.svelte'
|
||||
import SidebarButton from '$lib/components/ui/sidebar/SidebarButton.svelte'
|
||||
import { LINKED_INSTANCE_URL } from '$lib/instance.svelte'
|
||||
import ProfileAvatar from '$lib/lemmy/ProfileAvatar.svelte'
|
||||
@@ -9,7 +9,7 @@
|
||||
|
||||
let switching: boolean = $state(false)
|
||||
interface Props {
|
||||
prof: Profile
|
||||
prof: ProfileInfo
|
||||
index: number
|
||||
guest?: boolean
|
||||
}
|
||||
@@ -28,7 +28,7 @@
|
||||
switching = true
|
||||
|
||||
if (profile.current?.id != prof.id) {
|
||||
await setUserID(prof.id)
|
||||
profile.meta.profile = prof.id
|
||||
}
|
||||
|
||||
await goto(page.url, {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<script lang="ts">
|
||||
import { notifications, profile, profileData } from '$lib/auth.svelte.js'
|
||||
import { notifications, profile } from '$lib/auth.svelte.js'
|
||||
import Expandable from '$lib/components/ui/Expandable.svelte'
|
||||
import CommunityList from '$lib/components/ui/sidebar/CommunityList.svelte'
|
||||
import ProfileButton from '$lib/components/ui/sidebar/ProfileButton.svelte'
|
||||
@@ -88,7 +88,7 @@
|
||||
{/snippet}
|
||||
</SidebarButton>
|
||||
{/if}
|
||||
{#if profileData.profiles.length >= 1}
|
||||
{#if profile.meta.profiles.length >= 1}
|
||||
<hr class="border-slate-200 dark:border-zinc-900 my-1" />
|
||||
|
||||
<Expandable
|
||||
@@ -101,14 +101,14 @@
|
||||
{$t('account.accounts')}
|
||||
{#snippet action()}
|
||||
<span class="dark:text-white text-black">
|
||||
{profileData.profiles.length}
|
||||
{profile.meta.profiles.length}
|
||||
</span>
|
||||
{/snippet}
|
||||
</EndPlaceholder>
|
||||
</span>
|
||||
{/snippet}
|
||||
<div class="w-full flex gap-px flex-col">
|
||||
{#each [...profileData.profiles] as prof, index}
|
||||
{#each [...profile.meta.profiles] as prof, index}
|
||||
<div class="w-full">
|
||||
<ProfileButton {index} {prof} />
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user