auth: rename profile.data -> profile.current
This commit is contained in:
76 files changed
+233
-224
No files matched your search
@@ -38,14 +38,14 @@
|
||||
|
||||
let switching = $state(-1)
|
||||
|
||||
let radioSelected = $state(profile.data.id)
|
||||
let radioSelected = $state(profile.current.id)
|
||||
$effect(() => {
|
||||
switching = radioSelected
|
||||
setUserID(radioSelected)
|
||||
})
|
||||
|
||||
$effect(() => {
|
||||
if (profile.data.user) switching = -1
|
||||
if (profile.current.user) switching = -1
|
||||
})
|
||||
</script>
|
||||
|
||||
@@ -55,7 +55,9 @@
|
||||
|
||||
{#if debugging}
|
||||
<DebugObject
|
||||
object={debugProfile?.id == profile.data?.id ? profile.data : debugProfile}
|
||||
object={debugProfile?.id == profile.current?.id
|
||||
? profile.current
|
||||
: debugProfile}
|
||||
bind:open={debugging}
|
||||
>
|
||||
{#snippet title()}
|
||||
|
||||
@@ -8,7 +8,7 @@ export async function load({ fetch, url }) {
|
||||
const uri = url.searchParams.get('uri')
|
||||
if (!uri) error(404)
|
||||
|
||||
if (!profile.data.jwt)
|
||||
if (!profile.current.jwt)
|
||||
redirect(302, `/login?ref=${encodeURIComponent(url.toString())}`)
|
||||
|
||||
return {
|
||||
|
||||
@@ -5,7 +5,7 @@ import { ReactiveState } from '$lib/promise.svelte.js'
|
||||
export async function load({ fetch, url }) {
|
||||
if (!profile) return
|
||||
|
||||
const { jwt } = profile.data!
|
||||
const { jwt } = profile.current!
|
||||
if (!jwt) return
|
||||
|
||||
const page = Number(url.searchParams.get('page')) || 1
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
let reviewing = $state(false)
|
||||
|
||||
async function review(approve: boolean) {
|
||||
if (!profile.data?.jwt) return
|
||||
if (!profile.current?.jwt) return
|
||||
|
||||
let registrationApplicationAnswer: ApproveRegistrationApplication = {
|
||||
approve: approve,
|
||||
@@ -67,7 +67,7 @@
|
||||
type: 'success',
|
||||
})
|
||||
application.creator_local_user.accepted_application = approve
|
||||
application.admin = profile.data.user!.local_user_view.person
|
||||
application.admin = profile.current.user!.local_user_view.person
|
||||
application.registration_application.deny_reason = denyReason
|
||||
|
||||
$notifications.applications -= 1
|
||||
|
||||
@@ -42,7 +42,7 @@
|
||||
)
|
||||
|
||||
async function save() {
|
||||
if (!profile.data?.jwt) return
|
||||
if (!profile.current?.jwt) return
|
||||
|
||||
saving = true
|
||||
|
||||
|
||||
@@ -44,7 +44,7 @@
|
||||
if (instance == '') return
|
||||
await trycatch(async () => {
|
||||
if (
|
||||
!profile.data?.jwt ||
|
||||
!profile.current?.jwt ||
|
||||
!data.federated_instances?.federated_instances?.blocked ||
|
||||
!data.federated_instances?.federated_instances?.allowed
|
||||
)
|
||||
@@ -81,7 +81,7 @@
|
||||
const save = async () => {
|
||||
const res = await trycatch(async () => {
|
||||
if (
|
||||
!profile.data?.jwt ||
|
||||
!profile.current?.jwt ||
|
||||
!data.federated_instances?.federated_instances?.blocked
|
||||
)
|
||||
return
|
||||
|
||||
@@ -3,7 +3,7 @@ import { client } from '$lib/lemmy.svelte.js'
|
||||
import { ReactiveState } from '$lib/promise.svelte.js'
|
||||
|
||||
export async function load({ fetch, url }) {
|
||||
const { jwt } = profile.data
|
||||
const { jwt } = profile.current
|
||||
|
||||
const page = Number(url.searchParams.get('page')) || 1
|
||||
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
let saving = $state(false)
|
||||
|
||||
async function save() {
|
||||
if (!profile.data?.jwt) return
|
||||
if (!profile.current?.jwt) return
|
||||
|
||||
saving = true
|
||||
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
action: () => removeAdmin(id, true),
|
||||
})
|
||||
|
||||
if (!profile.data?.jwt) return
|
||||
if (!profile.current?.jwt) return
|
||||
|
||||
const result = await trycatch(() =>
|
||||
getClient().addAdmin({
|
||||
@@ -77,7 +77,7 @@
|
||||
class="flex flex-row items-center gap-2 mt-auto w-full"
|
||||
onsubmit={preventDefault(() => {
|
||||
trycatch(async () => {
|
||||
if (!profile.data?.jwt || newAdmin == '') return
|
||||
if (!profile.current?.jwt || newAdmin == '') return
|
||||
adding = true
|
||||
|
||||
const r = await addAdmin(`${newAdmin}@${instance.data}`, true)
|
||||
|
||||
@@ -81,10 +81,10 @@
|
||||
{/snippet}
|
||||
</Header>
|
||||
|
||||
{#if profile.data.user}
|
||||
{#if !data.community.value.discussion_languages.every( l => profile.data.user?.discussion_languages.includes(l), ) && profile.data.user.discussion_languages.length > 0}
|
||||
{#if profile.current.user}
|
||||
{#if !data.community.value.discussion_languages.every( l => profile.current.user?.discussion_languages.includes(l), ) && profile.current.user.discussion_languages.length > 0}
|
||||
{@const missing = data.community.value.discussion_languages.filter(
|
||||
i => !profile.data.user?.discussion_languages.includes(i),
|
||||
i => !profile.current.user?.discussion_languages.includes(i),
|
||||
)}
|
||||
<Note class="p-1! pl-3! flex-col md:flex-row">
|
||||
<div>{$t('routes.community.languageWarning')}</div>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
})
|
||||
|
||||
async function addModerator() {
|
||||
if (!profile.data?.jwt) return
|
||||
if (!profile.current?.jwt) return
|
||||
|
||||
formData.addingModerator = true
|
||||
|
||||
@@ -80,7 +80,7 @@
|
||||
}
|
||||
|
||||
async function removeMod(id: number) {
|
||||
if (!profile.data?.jwt) return
|
||||
if (!profile.current?.jwt) return
|
||||
|
||||
try {
|
||||
const res = await getClient().addModToCommunity({
|
||||
|
||||
@@ -4,11 +4,11 @@ import { client } from '$lib/lemmy.svelte.js'
|
||||
import { redirect } from '@sveltejs/kit'
|
||||
|
||||
export async function load({ params, fetch }) {
|
||||
if (profile.data.instance != params.instance)
|
||||
if (profile.current.instance != params.instance)
|
||||
redirect(302, resolveRoute('/comment/[instance]/[id]/confirm', params))
|
||||
|
||||
const comment = await client({
|
||||
instanceURL: profile.data.instance,
|
||||
instanceURL: profile.current.instance,
|
||||
func: fetch,
|
||||
}).getComment({
|
||||
id: Number(params.id),
|
||||
@@ -16,6 +16,6 @@ export async function load({ params, fetch }) {
|
||||
|
||||
redirect(
|
||||
302,
|
||||
`/post/${profile.data.instance}/${comment.comment_view.post.id}?thread=${comment.comment_view.comment.path}#${comment.comment_view.comment.id}`,
|
||||
`/post/${profile.current.instance}/${comment.comment_view.post.id}?thread=${comment.comment_view.comment.path}#${comment.comment_view.comment.id}`,
|
||||
)
|
||||
}
|
||||
@@ -15,7 +15,7 @@
|
||||
import { Plus } from 'svelte-hero-icons'
|
||||
|
||||
let loading = $state(false)
|
||||
const fetched = $state.snapshot(profile.data.instance)
|
||||
const fetched = $state.snapshot(profile.current.instance)
|
||||
|
||||
async function fetchOnHome() {
|
||||
loading = true
|
||||
@@ -27,7 +27,7 @@
|
||||
if (res.comment) {
|
||||
goto(
|
||||
resolveRoute(`/comment/[instance]/[id]`, {
|
||||
instance: profile.data.instance,
|
||||
instance: profile.current.instance,
|
||||
id: res.comment.comment.id.toString(),
|
||||
}),
|
||||
)
|
||||
@@ -56,7 +56,7 @@
|
||||
</p>
|
||||
</header>
|
||||
<div class="flex flex-row items-center gap-2 flex-wrap">
|
||||
{#if profile.data.jwt}
|
||||
{#if profile.current.jwt}
|
||||
<Button
|
||||
{loading}
|
||||
disabled={loading}
|
||||
|
||||
@@ -2,6 +2,6 @@ import { profile } from '$lib/auth.svelte.js'
|
||||
import { redirect } from '@sveltejs/kit'
|
||||
|
||||
export async function load({ params }) {
|
||||
if (profile.data.instance == params.instance)
|
||||
if (profile.current.instance == params.instance)
|
||||
redirect(302, `/comment/${params.instance}/${params.id}`)
|
||||
}
|
||||
@@ -32,7 +32,7 @@
|
||||
id: number | undefined = community?.community.id,
|
||||
subscribed: SubscribedType | undefined = community?.subscribed,
|
||||
) {
|
||||
if (!profile.data?.jwt) return
|
||||
if (!profile.current?.jwt) return
|
||||
if (!id || !subscribed) return
|
||||
|
||||
subscribing = true
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
let { data } = $props()
|
||||
|
||||
onMount(() => {
|
||||
if (!profile.data?.jwt) {
|
||||
if (!profile.current?.jwt) {
|
||||
goto('/login')
|
||||
}
|
||||
})
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
let markingAsRead = $state(false)
|
||||
|
||||
async function markAllAsRead() {
|
||||
if (!profile.data?.user) {
|
||||
if (!profile.current?.user) {
|
||||
goto('/login')
|
||||
return
|
||||
}
|
||||
@@ -156,7 +156,7 @@ items-center px-2 w-max top-6 lg:top-22"
|
||||
/>
|
||||
{:else}
|
||||
{#each data.inbox.value as item, index}
|
||||
{#if item.creator.id != profile.data.user?.local_user_view.person.id}
|
||||
{#if item.creator.id != profile.current.user?.local_user_view.person.id}
|
||||
<div
|
||||
class="-mx-4 sm:-mx-6 px-4 sm:px-6
|
||||
{item.read ? '' : 'bg-blue-50/50 dark:bg-blue-500/5'}"
|
||||
|
||||
@@ -12,7 +12,7 @@ import { error } from '@sveltejs/kit'
|
||||
type InboxFeedType = 'replies' | 'mentions' | 'messages' | 'all'
|
||||
|
||||
export async function load({ url, fetch }) {
|
||||
if (!profile.data.jwt) error(401)
|
||||
if (!profile.current.jwt) error(401)
|
||||
|
||||
const type: InboxFeedType =
|
||||
(url.searchParams.get('type') as InboxFeedType) || 'all'
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
let loading = $state(false)
|
||||
|
||||
async function markAsRead(isRead: boolean) {
|
||||
if (!profile.data?.jwt) return
|
||||
if (!profile.current?.jwt) return
|
||||
|
||||
loading = true
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
}
|
||||
|
||||
item.read = isRead
|
||||
if (profile.data.user) $notifications.inbox += isRead ? -1 : 1
|
||||
if (profile.current.user) $notifications.inbox += isRead ? -1 : 1
|
||||
|
||||
loading = false
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
}
|
||||
|
||||
function getOtherPartyId(message: PrivateMessageView): number {
|
||||
return message.creator.id == profile.data.user?.local_user_view.person.id
|
||||
return message.creator.id == profile.current.user?.local_user_view.person.id
|
||||
? message.recipient.id
|
||||
: message.creator.id
|
||||
}
|
||||
@@ -56,7 +56,7 @@
|
||||
.filter(c => c.creator.id != c.recipient.id) // you messaged yourself
|
||||
.map(i => ({
|
||||
user:
|
||||
i.creator.id != profile.data.user?.local_user_view.person.id
|
||||
i.creator.id != profile.current.user?.local_user_view.person.id
|
||||
? i.creator
|
||||
: i.recipient,
|
||||
message: {
|
||||
@@ -153,8 +153,8 @@
|
||||
bg-linear-to-r from-slate-700 via-slate-700 to-slate-700/0 dark:from-zinc-300 dark:via-zinc-300 dark:to-zinc-300/0
|
||||
text-transparent bg-clip-text flex-1 overflow-hidden"
|
||||
>
|
||||
{#if preview.message.last_sender == profile.data.user?.local_user_view.person.id}
|
||||
{profile.data.user?.local_user_view.person.name}:
|
||||
{#if preview.message.last_sender == profile.current.user?.local_user_view.person.id}
|
||||
{profile.current.user?.local_user_view.person.name}:
|
||||
{/if}
|
||||
{preview.message.content}
|
||||
</div>
|
||||
|
||||
@@ -2,5 +2,5 @@ import { profile } from '$lib/auth.svelte'
|
||||
import { error } from '@sveltejs/kit'
|
||||
|
||||
export function load() {
|
||||
if (!profile.data.jwt) error(401)
|
||||
if (!profile.current.jwt) error(401)
|
||||
}
|
||||
@@ -14,7 +14,7 @@ import { error } from '@sveltejs/kit'
|
||||
type ReportListType = 'unread' | 'all'
|
||||
|
||||
export async function load({ url, fetch }) {
|
||||
if (!profile.data.jwt) error(401)
|
||||
if (!profile.current.jwt) error(401)
|
||||
|
||||
const page = Number(url.searchParams.get('page')) || 1
|
||||
const type: ReportListType =
|
||||
@@ -30,7 +30,7 @@ export async function load({ url, fetch }) {
|
||||
community_id: community,
|
||||
}
|
||||
|
||||
const admin = profile.data?.user ? isAdmin(profile!.data.user!) : false
|
||||
const admin = profile.current?.user ? isAdmin(profile!.data.user!) : false
|
||||
|
||||
const [posts, comments, messages] = await Promise.all([
|
||||
client.listPostReports({
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
|
||||
let resolving = $state(false)
|
||||
async function resolve() {
|
||||
if (!profile.data?.jwt || !profile.data.user) return
|
||||
if (!profile.current?.jwt || !profile.current.user) return
|
||||
resolving = true
|
||||
|
||||
try {
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
{$t('nav.communities')}
|
||||
</Header>
|
||||
<div class="w-full h-full flex flex-col mt-4">
|
||||
{#if !profile.data.user}
|
||||
{#if !profile.current.user}
|
||||
<div class="mx-auto my-auto">
|
||||
<Spinner width={24} />
|
||||
</div>
|
||||
@@ -20,7 +20,7 @@
|
||||
rounding="2xl"
|
||||
class="flex flex-col dark:bg-zinc-950 max-h-[32rem] overflow-auto"
|
||||
>
|
||||
{#each profile.data.user.moderates as moderate}
|
||||
{#each profile.current.user.moderates as moderate}
|
||||
{@const community = moderate.community}
|
||||
<div
|
||||
class="-mx-4 px-4 hover:bg-slate-100 hover:dark:bg-zinc-900 transition-colors duration-75"
|
||||
|
||||
@@ -206,7 +206,7 @@
|
||||
<UserAutocomplete
|
||||
instance={page.url.searchParams.get('instance') || undefined}
|
||||
placeholder="Filter by user"
|
||||
jwt={profile.data?.jwt}
|
||||
jwt={profile.current?.jwt}
|
||||
listing_type="All"
|
||||
showWhenEmpty={true}
|
||||
class="flex-1"
|
||||
@@ -217,10 +217,10 @@
|
||||
onselect={e =>
|
||||
searchParam(page.url, 'user', e?.id.toString() ?? '', 'page')}
|
||||
/>
|
||||
{#if profile.data?.user && isAdmin(profile.data?.user)}
|
||||
{#if profile.current?.user && isAdmin(profile.current?.user)}
|
||||
<UserAutocomplete
|
||||
placeholder="Filter by moderator"
|
||||
jwt={profile.data?.jwt}
|
||||
jwt={profile.current?.jwt}
|
||||
listing_type="All"
|
||||
showWhenEmpty={true}
|
||||
class="flex-1"
|
||||
|
||||
@@ -7,7 +7,7 @@ export function load({ params }) {
|
||||
redirect(
|
||||
302,
|
||||
resolveRoute(`/post/[instance]/[id]`, {
|
||||
instance: profile.data.instance.toLowerCase(),
|
||||
instance: profile.current.instance.toLowerCase(),
|
||||
id: params.instance,
|
||||
}),
|
||||
)
|
||||
|
||||
@@ -37,7 +37,7 @@
|
||||
onMount(async () => {
|
||||
if (
|
||||
!(data.post.value.post_view.read && settings.markPostsAsRead) &&
|
||||
profile.data?.jwt
|
||||
profile.current?.jwt
|
||||
) {
|
||||
getClient().markPostAsRead({
|
||||
read: settings.markPostsAsRead,
|
||||
|
||||
@@ -28,7 +28,7 @@ function buildContext(thread?: string) {
|
||||
}
|
||||
|
||||
export async function load({ params, url, fetch }) {
|
||||
if (profile.data.instance != params.instance)
|
||||
if (profile.current.instance != params.instance)
|
||||
redirect(302, resolveRoute('/post/[instance]/[id]/confirm', params))
|
||||
|
||||
// TODO use Lemmy profile default settings
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
})
|
||||
</script>
|
||||
|
||||
{#if profile.data?.jwt}
|
||||
{#if profile.current?.jwt}
|
||||
{#if !commenting}
|
||||
<EndPlaceholder>
|
||||
<Button
|
||||
@@ -60,8 +60,8 @@
|
||||
disabled={(post.post_view.post.locked ||
|
||||
post.post_view.banned_from_community) &&
|
||||
!(
|
||||
profile.data?.user?.local_user_view.local_user.admin ||
|
||||
profile.data?.user?.moderates
|
||||
profile.current?.user?.local_user_view.local_user.admin ||
|
||||
profile.current?.user?.moderates
|
||||
.map(c => c.community.id)
|
||||
.includes(post.community_view.community.id)
|
||||
)}
|
||||
@@ -119,7 +119,7 @@
|
||||
{/if}
|
||||
{/if}
|
||||
|
||||
{#if commenting || !profile.data.jwt}
|
||||
{#if commenting || !profile.current.jwt}
|
||||
<div class="gap-2 flex items-center">
|
||||
<Select
|
||||
size="md"
|
||||
|
||||
@@ -15,7 +15,7 @@
|
||||
import { Plus } from 'svelte-hero-icons'
|
||||
|
||||
let loading = $state(false)
|
||||
const fetched = $state.snapshot(profile.data.instance)
|
||||
const fetched = $state.snapshot(profile.current.instance)
|
||||
|
||||
async function fetchOnHome() {
|
||||
loading = true
|
||||
@@ -27,7 +27,7 @@
|
||||
if (res.post) {
|
||||
goto(
|
||||
resolveRoute(`/post/[instance]/[id]`, {
|
||||
instance: profile.data.instance,
|
||||
instance: profile.current.instance,
|
||||
id: res.post.post.id.toString(),
|
||||
}),
|
||||
)
|
||||
@@ -56,7 +56,7 @@
|
||||
</p>
|
||||
</header>
|
||||
<div class="flex flex-row items-center gap-2 flex-wrap">
|
||||
{#if profile.data.jwt}
|
||||
{#if profile.current.jwt}
|
||||
<Button
|
||||
{loading}
|
||||
disabled={loading}
|
||||
|
||||
@@ -2,6 +2,6 @@ import { profile } from '$lib/auth.svelte.js'
|
||||
import { redirect } from '@sveltejs/kit'
|
||||
|
||||
export async function load({ params }) {
|
||||
if (profile.data.instance == params.instance)
|
||||
if (profile.current.instance == params.instance)
|
||||
redirect(302, `/post/${params.instance}/${params.id}`)
|
||||
}
|
||||
@@ -30,7 +30,7 @@
|
||||
let data = $state(pageData)
|
||||
|
||||
async function unblockUser(item: PersonBlockView) {
|
||||
if (!profile.data?.jwt) return
|
||||
if (!profile.current?.jwt) return
|
||||
|
||||
data.person_blocks.splice(
|
||||
data.person_blocks.findIndex(i => i.target.id == item.target.id),
|
||||
@@ -46,7 +46,7 @@
|
||||
}
|
||||
|
||||
async function unblockCommunity(item: CommunityBlockView) {
|
||||
if (!profile.data?.jwt) return
|
||||
if (!profile.current?.jwt) return
|
||||
|
||||
data.community_blocks.splice(
|
||||
data.community_blocks.findIndex(i => i.community.id == item.community.id),
|
||||
@@ -63,7 +63,7 @@
|
||||
}
|
||||
|
||||
async function unblockInstances(item: InstanceBlockView) {
|
||||
if (!profile.data?.jwt) return
|
||||
if (!profile.current?.jwt) return
|
||||
if (!data.my_user?.instance_blocks) return
|
||||
|
||||
data.my_user.instance_blocks.splice(
|
||||
|
||||
@@ -21,8 +21,8 @@
|
||||
old_password: oldPassword,
|
||||
})
|
||||
if (res?.jwt) {
|
||||
const { instance, username } = profile.data
|
||||
deleteProfile(profile.data.id)
|
||||
const { instance, username } = profile.current
|
||||
deleteProfile(profile.current.id)
|
||||
await setUser(res.jwt, instance, username!)
|
||||
|
||||
toast({ content: $t('toast.loginRefresh'), type: 'success' })
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
let bannerImage: FileList | undefined = $state()
|
||||
|
||||
async function save() {
|
||||
if (!formData || !profile.data?.jwt) return
|
||||
if (!formData || !profile.current?.jwt) return
|
||||
|
||||
loading = true
|
||||
|
||||
@@ -49,16 +49,16 @@
|
||||
let pfp = profileImage
|
||||
? await uploadImage(
|
||||
profileImage[0],
|
||||
profile.data.instance,
|
||||
profile.data.jwt,
|
||||
profile.current.instance,
|
||||
profile.current.jwt,
|
||||
)
|
||||
: undefined
|
||||
|
||||
let banner = bannerImage
|
||||
? await uploadImage(
|
||||
bannerImage[0],
|
||||
profile.data.instance,
|
||||
profile.data.jwt,
|
||||
profile.current.instance,
|
||||
profile.current.jwt,
|
||||
)
|
||||
: undefined
|
||||
|
||||
|
||||
@@ -6,11 +6,12 @@ import { error } from '@sveltejs/kit'
|
||||
export const ssr = false
|
||||
|
||||
export async function load({ fetch }) {
|
||||
if (!profile.data.jwt) error(401)
|
||||
if (!profile.current.jwt) error(401)
|
||||
|
||||
const my_user =
|
||||
// profile.data?.user ??
|
||||
(await client({ auth: profile.data?.jwt, func: fetch }).getSite()).my_user
|
||||
// profile.current?.user ??
|
||||
(await client({ auth: profile.current?.jwt, func: fetch }).getSite())
|
||||
.my_user
|
||||
|
||||
return {
|
||||
my_user: my_user,
|
||||
|
||||
@@ -3,7 +3,7 @@ import { client } from '$lib/lemmy.svelte.js'
|
||||
import { ReactiveState } from '$lib/promise.svelte.js'
|
||||
|
||||
export async function load({ fetch, url }) {
|
||||
const { jwt } = profile.data
|
||||
const { jwt } = profile.current
|
||||
|
||||
const page = Number(url.searchParams.get('page')) || 1
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ function getSavedItemPublished(item: PostView | CommentView) {
|
||||
}
|
||||
|
||||
export async function load({ url, fetch }) {
|
||||
if (!profile.data.jwt) throw error(401)
|
||||
if (!profile.current.jwt) throw error(401)
|
||||
|
||||
const page = Number(url.searchParams.get('page')) || 1
|
||||
const type: 'comments' | 'posts' | 'all' =
|
||||
|
||||
@@ -96,7 +96,7 @@
|
||||
>
|
||||
<ObjectAutocomplete
|
||||
label={$t('nav.create.community')}
|
||||
jwt={profile.data?.jwt}
|
||||
jwt={profile.current?.jwt}
|
||||
listing_type="All"
|
||||
showWhenEmpty={true}
|
||||
onselect={c =>
|
||||
|
||||
@@ -50,7 +50,7 @@ export async function load({ url, fetch }) {
|
||||
})!,
|
||||
results: new ReactiveState(everything),
|
||||
streamed: {
|
||||
object: profile.data?.jwt
|
||||
object: profile.current?.jwt
|
||||
? getClient(undefined, fetch).resolveObject({
|
||||
q: query,
|
||||
})
|
||||
|
||||
@@ -208,7 +208,7 @@
|
||||
class="flex flex-col *:py-2 divide-y divide-slate-200 dark:divide-zinc-800"
|
||||
style="scroll-behavior: smooth;"
|
||||
>
|
||||
{#if profile.data?.jwt}
|
||||
{#if profile.current?.jwt}
|
||||
<Section open={false} id="account" title={$t('settings.account.title')}>
|
||||
<div>
|
||||
<Button
|
||||
|
||||
@@ -55,11 +55,11 @@
|
||||
let sortForm = $state<HTMLFormElement>()
|
||||
|
||||
async function blockUser(block: number) {
|
||||
if (!profile.data?.user || !profile.data?.jwt)
|
||||
if (!profile.current?.user || !profile.current?.jwt)
|
||||
throw new Error('Unauthenticated')
|
||||
|
||||
try {
|
||||
const blocked = isBlocked(profile.data.user, block)
|
||||
const blocked = isBlocked(profile.current.user, block)
|
||||
|
||||
await getClient().blockPerson({
|
||||
block: !blocked,
|
||||
@@ -67,10 +67,10 @@
|
||||
})
|
||||
|
||||
if (blocked) {
|
||||
const index = profile.data.user.person_blocks
|
||||
const index = profile.current.user.person_blocks
|
||||
.map(p => p.target.id)
|
||||
.indexOf(block)
|
||||
profile.data.user.person_blocks.splice(index, 1)
|
||||
profile.current.user.person_blocks.splice(index, 1)
|
||||
}
|
||||
|
||||
toast({
|
||||
@@ -210,7 +210,7 @@
|
||||
</Expandable>
|
||||
{/if}
|
||||
{#snippet actions()}
|
||||
{#if profile.data?.user && profile.data.jwt && data.person_view.value.person.id != profile.data.user.local_user_view.person.id}
|
||||
{#if profile.current?.user && profile.current.jwt && data.person_view.value.person.id != profile.current.user.local_user_view.person.id}
|
||||
<div class="flex items-center gap-2 w-full flex-wrap">
|
||||
<Button
|
||||
size="sm"
|
||||
@@ -237,7 +237,7 @@
|
||||
{$t('form.profile.matrix')}
|
||||
</Button>
|
||||
{/if}
|
||||
{#if isAdmin(profile.data?.user)}
|
||||
{#if isAdmin(profile.current?.user)}
|
||||
<Menu class="ml-auto" placement="bottom-end">
|
||||
{#snippet target()}
|
||||
<Button size="sm" rounding="pill">
|
||||
@@ -292,7 +292,7 @@
|
||||
<Icon mini size="16" src={NoSymbol} />
|
||||
{/snippet}
|
||||
{isBlocked(
|
||||
profile.data.user,
|
||||
profile.current.user,
|
||||
data.person_view.value.person.id,
|
||||
)
|
||||
? 'Unblock'
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
style="rotate: -5deg; transition: rotate 1s linear;"
|
||||
>
|
||||
<div class="bg-black/20 font-mono fixed left-1/2 -translate-x-1/2">
|
||||
<p>{profile.data.username ?? 'You'} was slain by Command Palette</p>
|
||||
<p>{profile.current.username ?? 'You'} was slain by Command Palette</p>
|
||||
</div>
|
||||
<img
|
||||
src="/other/mc.png"
|
||||
|
||||
Reference in new issue
Block a user