auth: rename profile.data -> profile.current
This commit is contained in:
76 files changed
+233
-224
No files matched your search
@@ -45,7 +45,7 @@
|
||||
})
|
||||
|
||||
async function submit() {
|
||||
if (!item || !profile.data?.user || !profile.data?.jwt) return
|
||||
if (!item || !profile.current?.user || !profile.current?.jwt) return
|
||||
|
||||
loading = true
|
||||
|
||||
|
||||
@@ -34,9 +34,9 @@
|
||||
<ShieldIcon filled width={14} />
|
||||
</Button>
|
||||
{/snippet}
|
||||
{#if (profile.data?.user && amMod(profile.data.user, item.community)) || (profile.data?.user && isAdmin(profile.data.user))}
|
||||
{#if (profile.current?.user && amMod(profile.current.user, item.community)) || (profile.current?.user && isAdmin(profile.current.user))}
|
||||
<MenuDivider>
|
||||
{#if !item.community.local && !amMod(profile.data.user, item.community)}
|
||||
{#if !item.community.local && !amMod(profile.current.user, item.community)}
|
||||
{$t('moderation.labelInstanceOnly')}
|
||||
{:else}
|
||||
{$t('moderation.label')}
|
||||
@@ -52,7 +52,7 @@
|
||||
: $t('moderation.remove')}
|
||||
{/if}
|
||||
</MenuButton>
|
||||
{#if profile.data?.user && profile.data.user?.local_user_view.person.id != item.creator.id}
|
||||
{#if profile.current?.user && profile.current.user?.local_user_view.person.id != item.creator.id}
|
||||
<!--Comment made by someone else-->
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
@@ -71,12 +71,12 @@
|
||||
<MenuButton
|
||||
color="success-subtle"
|
||||
onclick={async () => {
|
||||
if (!profile.data.jwt) return
|
||||
if (!profile.current.jwt) return
|
||||
item.comment = (
|
||||
await feature(
|
||||
!item.comment.distinguished,
|
||||
item.comment,
|
||||
profile.data.jwt,
|
||||
profile.current.jwt,
|
||||
)
|
||||
).comment_view.comment
|
||||
}}
|
||||
@@ -104,7 +104,7 @@
|
||||
</MenuButton>
|
||||
{/if}
|
||||
|
||||
{#if profile.data?.user && isAdmin(profile.data.user)}
|
||||
{#if profile.current?.user && isAdmin(profile.current.user)}
|
||||
<MenuDivider>{$t('admin.label')}</MenuDivider>
|
||||
<MenuButton color="danger-subtle" onclick={() => remove(item, true)}>
|
||||
{#snippet prefix()}
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
let acting = $derived(locking || pinning)
|
||||
|
||||
async function lock(lock: boolean) {
|
||||
if (!profile.data?.jwt || !isPostView(item)) return
|
||||
if (!profile.current?.jwt || !isPostView(item)) return
|
||||
locking = true
|
||||
|
||||
try {
|
||||
@@ -53,7 +53,7 @@
|
||||
}
|
||||
|
||||
async function pin(pinned: boolean, toInstance: boolean = false) {
|
||||
if (!profile.data?.jwt || !isPostView(item)) return
|
||||
if (!profile.current?.jwt || !isPostView(item)) return
|
||||
|
||||
pinning = true
|
||||
|
||||
@@ -88,9 +88,9 @@
|
||||
<ShieldIcon filled width={16} />
|
||||
</Button>
|
||||
{/snippet}
|
||||
{#if (profile.data?.user && amMod(profile.data.user, item.community)) || (profile.data?.user && isAdmin(profile.data.user))}
|
||||
{#if (profile.current?.user && amMod(profile.current.user, item.community)) || (profile.current?.user && isAdmin(profile.current.user))}
|
||||
<MenuDivider>
|
||||
{#if !item.community.local && !amMod(profile.data.user, item.community)}
|
||||
{#if !item.community.local && !amMod(profile.current.user, item.community)}
|
||||
{$t('moderation.labelInstanceOnly')}
|
||||
{:else}
|
||||
{$t('moderation.label')}
|
||||
@@ -124,7 +124,7 @@
|
||||
? $t('moderation.unfeature')
|
||||
: $t('moderation.feature')}
|
||||
</span>
|
||||
{#if isAdmin(profile.data.user)}
|
||||
{#if isAdmin(profile.current.user)}
|
||||
<span class="text-xs opacity-80">{$t('form.post.community')}</span>
|
||||
{/if}
|
||||
</div>
|
||||
@@ -139,7 +139,7 @@
|
||||
{item.post.removed ? $t('moderation.restore') : $t('moderation.remove')}
|
||||
{/if}
|
||||
</MenuButton>
|
||||
{#if profile.data?.user && profile.data.user.local_user_view.person.id != item.creator.id}
|
||||
{#if profile.current?.user && profile.current.user.local_user_view.person.id != item.creator.id}
|
||||
<MenuButton
|
||||
color="danger-subtle"
|
||||
onclick={() =>
|
||||
@@ -164,7 +164,7 @@
|
||||
{$t('moderation.votes')}
|
||||
</MenuButton>
|
||||
{/if}
|
||||
{#if profile.data?.user && isAdmin(profile.data.user)}
|
||||
{#if profile.current?.user && isAdmin(profile.current.user)}
|
||||
<MenuDivider>{$t('admin.label')}</MenuDivider>
|
||||
<MenuButton
|
||||
color="success-subtle"
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
|
||||
async function remove() {
|
||||
if (!item) return
|
||||
if (!profile.data?.jwt) throw new Error('Unauthenticated')
|
||||
if (!profile.current?.jwt) throw new Error('Unauthenticated')
|
||||
|
||||
loading = true
|
||||
|
||||
@@ -216,7 +216,7 @@
|
||||
bind:value={reason}
|
||||
/>
|
||||
|
||||
{#if !removed && profile.data?.user && (amMod(profile.data.user, item.community) || (isAdmin(profile.data.user) && item.community.local))}
|
||||
{#if !removed && profile.current?.user && (amMod(profile.current.user, item.community) || (isAdmin(profile.current.user) && item.community.local))}
|
||||
<Switch bind:checked={commentReason}>
|
||||
{$t('moderation.removeSubmission.withReason')}
|
||||
</Switch>
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
let reason = $state('')
|
||||
|
||||
async function report() {
|
||||
if (!item || !profile.data?.jwt || reason == '') return
|
||||
if (!item || !profile.current?.jwt || reason == '') return
|
||||
loading = true
|
||||
|
||||
try {
|
||||
|
||||
Reference in new issue
Block a user