auth: rename profile.data -> profile.current
This commit is contained in:
76 files changed
+233
-224
No files matched your search
@@ -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>
|
||||
|
||||
Reference in new issue
Block a user