impr: replace amMod, amModOfAny, isAdmin, with profile class getters
This commit is contained in:
18 files changed
+89
-89
No files matched your search
@@ -2,7 +2,6 @@ import { getClient } from '$lib/api/client.svelte'
|
||||
import { profile } from '$lib/app/auth.svelte'
|
||||
import { ReactiveState } from '$lib/app/util.svelte'
|
||||
import { isCommentView, isPostView } from '$lib/feature/legacy/item'
|
||||
import { isAdmin } from '$lib/feature/moderation/moderation'
|
||||
import {
|
||||
generalizeCommentReport,
|
||||
generalizePostReport,
|
||||
@@ -30,7 +29,7 @@ export async function load({ url, fetch }) {
|
||||
community_id: community,
|
||||
}
|
||||
|
||||
const admin = profile.current?.user ? isAdmin(profile!.current.user!) : false
|
||||
const admin = profile.isAdmin
|
||||
|
||||
const [posts, comments, messages] = await Promise.all([
|
||||
client.listPostReports({
|
||||
|
||||
@@ -7,7 +7,6 @@
|
||||
import { settings } from '$lib/app/settings.svelte'
|
||||
import { searchParam } from '$lib/app/util.svelte'
|
||||
import CommunityLink from '$lib/feature/community/CommunityLink.svelte'
|
||||
import { isAdmin } from '$lib/feature/moderation/moderation'
|
||||
import { postLink } from '$lib/feature/post'
|
||||
import UserAutocomplete from '$lib/feature/user/UserAutocomplete.svelte'
|
||||
import UserLink from '$lib/feature/user/UserLink.svelte'
|
||||
@@ -194,7 +193,7 @@
|
||||
onselect={(e) =>
|
||||
searchParam(page.url, 'user', e?.id.toString() ?? '', 'page')}
|
||||
/>
|
||||
{#if profile.current?.user && isAdmin(profile.current?.user)}
|
||||
{#if profile.isAdmin}
|
||||
<UserAutocomplete
|
||||
placeholder="Filter by moderator"
|
||||
listing_type="All"
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
import type { PersonView } from '$lib/api/types'
|
||||
import { profile } from '$lib/app/auth.svelte'
|
||||
import { t } from '$lib/app/i18n'
|
||||
import { ban, isAdmin } from '$lib/feature/moderation/moderation'
|
||||
import { ban } from '$lib/feature/moderation/moderation'
|
||||
import { blockUser, isBlocked } from '$lib/feature/user'
|
||||
import {
|
||||
Button,
|
||||
@@ -91,7 +91,7 @@
|
||||
{$t('form.profile.matrix')}
|
||||
</Button>
|
||||
{/if}
|
||||
{#if isAdmin(profile.current?.user)}
|
||||
{#if profile.isAdmin}
|
||||
<Menu class="ml-auto" placement="bottom-end">
|
||||
{#snippet target(attachment)}
|
||||
<Button
|
||||
|
||||
Reference in new issue
Block a user