auth: rename profile.data -> profile.current
This commit is contained in:
76 files changed
+233
-224
No files matched your search
@@ -113,7 +113,7 @@
|
||||
})
|
||||
|
||||
async function subscribe() {
|
||||
if (!profile.data?.jwt) return
|
||||
if (!profile.current?.jwt) return
|
||||
loading.subscribing = true
|
||||
const subscribed =
|
||||
community_view.subscribed == 'Subscribed' ||
|
||||
@@ -227,7 +227,7 @@
|
||||
{/if}
|
||||
</div>
|
||||
<div class="flex flex-row items-center gap-1 sticky bottom-0 w-full">
|
||||
{#if profile.data?.jwt}
|
||||
{#if profile.current?.jwt}
|
||||
<Button
|
||||
disabled={loading.subscribing}
|
||||
loading={loading.subscribing}
|
||||
@@ -252,7 +252,7 @@
|
||||
: $t('cards.community.subscribe')}
|
||||
</Button>
|
||||
{/if}
|
||||
{#if profile.data?.user && amMod(profile.data.user, community_view.community)}
|
||||
{#if profile.current?.user && amMod(profile.current.user, community_view.community)}
|
||||
<Button
|
||||
href="/c/{fullCommunityName(
|
||||
community_view.community.name,
|
||||
@@ -278,7 +278,7 @@
|
||||
<Icon src={Newspaper} size="16" mini />
|
||||
{$t('cards.community.modlog')}
|
||||
</MenuButton>
|
||||
{#if profile.data?.jwt}
|
||||
{#if profile.current?.jwt}
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
size="lg"
|
||||
@@ -292,7 +292,7 @@
|
||||
? $t('cards.community.unblock')
|
||||
: $t('cards.community.block')}
|
||||
</MenuButton>
|
||||
{#if profile.data?.user}
|
||||
{#if profile.current?.user}
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
size="lg"
|
||||
@@ -304,7 +304,7 @@
|
||||
{$t('cards.community.blockInstance')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
{#if profile.data?.user && isAdmin(profile.data.user)}
|
||||
{#if profile.current?.user && isAdmin(profile.current.user)}
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
onclick={() =>
|
||||
|
||||
@@ -64,7 +64,7 @@
|
||||
let formData = $state(passedFormData)
|
||||
|
||||
async function submit() {
|
||||
if (!profile.data?.jwt) return
|
||||
if (!profile.current?.jwt) return
|
||||
if ((!edit && formData.name == '') || formData.displayName == '') return
|
||||
|
||||
formData.submitting = true
|
||||
@@ -99,23 +99,23 @@
|
||||
type: 'success',
|
||||
})
|
||||
|
||||
if (profile.data.user) {
|
||||
const c = profile.data.user.moderates
|
||||
if (profile.current.user) {
|
||||
const c = profile.current.user.moderates
|
||||
.map(m => m.community.id)
|
||||
.indexOf(res.community_view.community.id)
|
||||
if (c != -1) {
|
||||
profile.data.user.moderates[c] = {
|
||||
profile.current.user.moderates[c] = {
|
||||
community: res.community_view.community,
|
||||
moderator: profile.data.user.local_user_view.person,
|
||||
moderator: profile.current.user.local_user_view.person,
|
||||
}
|
||||
} else {
|
||||
profile.data.user = {
|
||||
...profile.data.user,
|
||||
profile.current.user = {
|
||||
...profile.current.user,
|
||||
moderates: [
|
||||
...profile.data.user.moderates,
|
||||
...profile.current.user.moderates,
|
||||
{
|
||||
community: res.community_view.community,
|
||||
moderator: profile.data.user.local_user_view.person,
|
||||
moderator: profile.current.user.local_user_view.person,
|
||||
},
|
||||
],
|
||||
}
|
||||
|
||||
@@ -115,7 +115,7 @@
|
||||
</Expandable>
|
||||
{/if}
|
||||
<div class="flex items-center gap-2 h-max w-max">
|
||||
{#if profile.data?.jwt}
|
||||
{#if profile.current?.jwt}
|
||||
<Subscribe
|
||||
community={{
|
||||
community: community,
|
||||
@@ -153,7 +153,7 @@
|
||||
</Subscribe>
|
||||
{/if}
|
||||
|
||||
{#if profile.data?.user && profile.data.user.moderates
|
||||
{#if profile.current?.user && profile.current.user.moderates
|
||||
.map(c => c.community.id)
|
||||
.includes(community.id)}
|
||||
<Button
|
||||
@@ -181,7 +181,7 @@
|
||||
<Icon src={Newspaper} size="16" mini />
|
||||
{$t('cards.community.modlog')}
|
||||
</MenuButton>
|
||||
{#if profile.data.user && amMod(profile.data.user, community)}
|
||||
{#if profile.current.user && amMod(profile.current.user, community)}
|
||||
<MenuButton
|
||||
color="success-subtle"
|
||||
href="/moderation?community={community.id}"
|
||||
@@ -190,7 +190,7 @@
|
||||
{$t('routes.moderation.feed')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
{#if profile.data?.jwt}
|
||||
{#if profile.current?.jwt}
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
size="lg"
|
||||
@@ -203,7 +203,7 @@
|
||||
? $t('cards.community.unblock')
|
||||
: $t('cards.community.block')}
|
||||
</MenuButton>
|
||||
{#if profile.data?.user}
|
||||
{#if profile.current?.user}
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
size="lg"
|
||||
@@ -215,7 +215,7 @@
|
||||
{$t('cards.community.blockInstance')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
{#if profile.data?.user && isAdmin(profile.data.user)}
|
||||
{#if profile.current?.user && isAdmin(profile.current.user)}
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
onclick={() =>
|
||||
|
||||
@@ -155,7 +155,7 @@
|
||||
<Subscribe {community}>
|
||||
{#snippet children({ subscribe, subscribing })}
|
||||
<Button
|
||||
disabled={subscribing || !profile.data?.jwt}
|
||||
disabled={subscribing || !profile.current?.jwt}
|
||||
loading={subscribing}
|
||||
onclick={async () => {
|
||||
const res = await subscribe()
|
||||
|
||||
Reference in new issue
Block a user