impr: add more options to moderation page (#604)
* feat: allow filtering by community on modpage * feat: add arbitrary banning * temp * feat: combine reports on reports page * design: clarify report design * fix: update lang key for navbar moderation
This commit is contained in:
1 parent
5b8f9d15af
commit
412977a484
16 files changed
+621
-190
No files matched your search
@@ -25,10 +25,11 @@
|
|||||||
Newspaper,
|
Newspaper,
|
||||||
NoSymbol,
|
NoSymbol,
|
||||||
Plus,
|
Plus,
|
||||||
|
ShieldCheck,
|
||||||
} from 'svelte-hero-icons'
|
} from 'svelte-hero-icons'
|
||||||
import Subscribe from '../../../../routes/communities/Subscribe.svelte'
|
import Subscribe from '../../../../routes/communities/Subscribe.svelte'
|
||||||
import ItemList from '../generic/ItemList.svelte'
|
import ItemList from '../generic/ItemList.svelte'
|
||||||
import { isAdmin } from '../moderation/moderation'
|
import { amMod, isAdmin } from '../moderation/moderation'
|
||||||
import { block, blockInstance, purgeCommunity } from './CommunityCard.svelte'
|
import { block, blockInstance, purgeCommunity } from './CommunityCard.svelte'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -37,6 +38,7 @@
|
|||||||
counts?: CommunityAggregates | undefined
|
counts?: CommunityAggregates | undefined
|
||||||
moderators?: CommunityModeratorView[]
|
moderators?: CommunityModeratorView[]
|
||||||
blocked?: boolean
|
blocked?: boolean
|
||||||
|
banner?: boolean
|
||||||
class?: string
|
class?: string
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -46,12 +48,13 @@
|
|||||||
counts = undefined,
|
counts = undefined,
|
||||||
moderators = [],
|
moderators = [],
|
||||||
blocked = false,
|
blocked = false,
|
||||||
|
banner = !(settings.nsfwBlur && community.nsfw),
|
||||||
class: clazz = '',
|
class: clazz = '',
|
||||||
}: Props = $props()
|
}: Props = $props()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<EntityHeader
|
<EntityHeader
|
||||||
banner={settings.nsfwBlur && community.nsfw ? undefined : community.banner}
|
banner={banner ? community.banner : undefined}
|
||||||
avatar={community.icon}
|
avatar={community.icon}
|
||||||
name={community.title}
|
name={community.title}
|
||||||
url="/c/{fullCommunityName(community.name, community.actor_id)}"
|
url="/c/{fullCommunityName(community.name, community.actor_id)}"
|
||||||
@@ -178,6 +181,15 @@
|
|||||||
<Icon src={Newspaper} size="16" mini />
|
<Icon src={Newspaper} size="16" mini />
|
||||||
{$t('cards.community.modlog')}
|
{$t('cards.community.modlog')}
|
||||||
</MenuButton>
|
</MenuButton>
|
||||||
|
{#if profile.data.user && amMod(profile.data.user, community)}
|
||||||
|
<MenuButton
|
||||||
|
color="success-subtle"
|
||||||
|
href="/moderation?community={community.id}"
|
||||||
|
>
|
||||||
|
<Icon src={ShieldCheck} size="16" micro />
|
||||||
|
{$t('routes.moderation.feed')}
|
||||||
|
</MenuButton>
|
||||||
|
{/if}
|
||||||
{#if profile.data?.jwt}
|
{#if profile.data?.jwt}
|
||||||
<MenuButton
|
<MenuButton
|
||||||
color="danger-subtle"
|
color="danger-subtle"
|
||||||
|
|||||||
@@ -21,6 +21,7 @@
|
|||||||
} from 'svelte-hero-icons'
|
} from 'svelte-hero-icons'
|
||||||
import Subscribe from '../../../../routes/communities/Subscribe.svelte'
|
import Subscribe from '../../../../routes/communities/Subscribe.svelte'
|
||||||
import { settings } from '$lib/settings.svelte'
|
import { settings } from '$lib/settings.svelte'
|
||||||
|
import type { Snippet } from 'svelte'
|
||||||
|
|
||||||
let showInfo = $state(false)
|
let showInfo = $state(false)
|
||||||
interface Props {
|
interface Props {
|
||||||
@@ -29,6 +30,7 @@
|
|||||||
showCounts?: boolean
|
showCounts?: boolean
|
||||||
class?: string
|
class?: string
|
||||||
icon?: import('svelte').Snippet
|
icon?: import('svelte').Snippet
|
||||||
|
children?: Snippet
|
||||||
}
|
}
|
||||||
|
|
||||||
let {
|
let {
|
||||||
@@ -37,6 +39,7 @@
|
|||||||
showCounts = true,
|
showCounts = true,
|
||||||
class: clazz = 'py-4 flex flex-col gap-4 text-sm max-w-full relative',
|
class: clazz = 'py-4 flex flex-col gap-4 text-sm max-w-full relative',
|
||||||
icon,
|
icon,
|
||||||
|
children,
|
||||||
}: Props = $props()
|
}: Props = $props()
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
@@ -137,66 +140,70 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</a>
|
</a>
|
||||||
<div class="flex flex-row items-center gap-2">
|
{#if children}
|
||||||
<Button
|
{@render children?.()}
|
||||||
size="square-md"
|
{:else}
|
||||||
rounding="pill"
|
<div class="flex flex-row items-center gap-2">
|
||||||
color="ghost"
|
<Button
|
||||||
onclick={() => (showInfo = !showInfo)}
|
size="square-md"
|
||||||
>
|
rounding="pill"
|
||||||
<Icon src={InformationCircle} size="16" mini />
|
color="ghost"
|
||||||
</Button>
|
onclick={() => (showInfo = !showInfo)}
|
||||||
<Subscribe {community}>
|
>
|
||||||
{#snippet children({ subscribe, subscribing })}
|
<Icon src={InformationCircle} size="16" mini />
|
||||||
<Button
|
</Button>
|
||||||
disabled={subscribing || !profile.data?.jwt}
|
<Subscribe {community}>
|
||||||
loading={subscribing}
|
{#snippet children({ subscribe, subscribing })}
|
||||||
onclick={async () => {
|
<Button
|
||||||
const res = await subscribe()
|
disabled={subscribing || !profile.data?.jwt}
|
||||||
|
loading={subscribing}
|
||||||
|
onclick={async () => {
|
||||||
|
const res = await subscribe()
|
||||||
|
|
||||||
if (res) {
|
if (res) {
|
||||||
const newSubscribed =
|
const newSubscribed =
|
||||||
res.community_view.subscribed != 'NotSubscribed'
|
res.community_view.subscribed != 'NotSubscribed'
|
||||||
? 'Subscribed'
|
? 'Subscribed'
|
||||||
: 'NotSubscribed'
|
: 'NotSubscribed'
|
||||||
|
|
||||||
community.subscribed = newSubscribed
|
community.subscribed = newSubscribed
|
||||||
addSubscription(
|
addSubscription(
|
||||||
community.community,
|
community.community,
|
||||||
newSubscribed == 'Subscribed',
|
newSubscribed == 'Subscribed',
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}}
|
}}
|
||||||
size="custom"
|
size="custom"
|
||||||
title={isSubscribed(community.subscribed)
|
title={isSubscribed(community.subscribed)
|
||||||
? $t('cards.community.subscribed')
|
? $t('cards.community.subscribed')
|
||||||
: $t('cards.community.subscribe')}
|
: $t('cards.community.subscribe')}
|
||||||
color={isSubscribed(community.subscribed)
|
color={isSubscribed(community.subscribed)
|
||||||
? 'elevatedLow'
|
? 'elevatedLow'
|
||||||
: 'primary'}
|
: 'primary'}
|
||||||
class="{isSubscribed(community.subscribed)
|
class="{isSubscribed(community.subscribed)
|
||||||
? 'text-slate-600 dark:text-zinc-400'
|
? 'text-slate-600 dark:text-zinc-400'
|
||||||
: ''}
|
: ''}
|
||||||
aspect-square h-8.5 @md:px-2 @md:min-w-30 @md:aspect-auto @md:rounded-full"
|
aspect-square h-8.5 @md:px-2 @md:min-w-30 @md:aspect-auto @md:rounded-full"
|
||||||
>
|
>
|
||||||
{#snippet prefix()}
|
{#snippet prefix()}
|
||||||
<Icon
|
<Icon
|
||||||
src={isSubscribed(community.subscribed) ? Check : Plus}
|
src={isSubscribed(community.subscribed) ? Check : Plus}
|
||||||
size="16"
|
size="16"
|
||||||
micro
|
micro
|
||||||
/>
|
/>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
<span class="hidden @md:block">
|
<span class="hidden @md:block">
|
||||||
{#if isSubscribed(community.subscribed)}
|
{#if isSubscribed(community.subscribed)}
|
||||||
{$t('cards.community.subscribed')}
|
{$t('cards.community.subscribed')}
|
||||||
{:else}
|
{:else}
|
||||||
{$t('cards.community.subscribe')}
|
{$t('cards.community.subscribe')}
|
||||||
{/if}
|
{/if}
|
||||||
</span>
|
</span>
|
||||||
</Button>
|
</Button>
|
||||||
{/snippet}
|
{/snippet}
|
||||||
</Subscribe>
|
</Subscribe>
|
||||||
</div>
|
</div>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{#if showCounts}
|
{#if showCounts}
|
||||||
<div class="flex flex-row gap-3 items-center justify-center">
|
<div class="flex flex-row gap-3 items-center justify-center">
|
||||||
|
|||||||
@@ -138,7 +138,7 @@
|
|||||||
</MenuButton>
|
</MenuButton>
|
||||||
{#if amModOfAny(profile.data.user)}
|
{#if amModOfAny(profile.data.user)}
|
||||||
<MenuButton href="/moderation" icon={ShieldCheck}>
|
<MenuButton href="/moderation" icon={ShieldCheck}>
|
||||||
{$t('routes.moderation.reports')}
|
{$t('routes.moderation.feed')}
|
||||||
{#snippet suffix()}
|
{#snippet suffix()}
|
||||||
{@render notifBadge($notifications.reports)}
|
{@render notifBadge($notifications.reports)}
|
||||||
{/snippet}
|
{/snippet}
|
||||||
|
|||||||
@@ -11,6 +11,7 @@
|
|||||||
import { Home, Icon, MagnifyingGlass } from 'svelte-hero-icons'
|
import { Home, Icon, MagnifyingGlass } from 'svelte-hero-icons'
|
||||||
import { getGroups, type Action, type Group } from './actions.svelte'
|
import { getGroups, type Action, type Group } from './actions.svelte'
|
||||||
import CommandItem from './CommandItem.svelte'
|
import CommandItem from './CommandItem.svelte'
|
||||||
|
import { fuzzySearch } from '$lib/util.svelte'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
open?: boolean
|
open?: boolean
|
||||||
@@ -37,38 +38,6 @@
|
|||||||
let breadcrumbs: Action[] = $state([])
|
let breadcrumbs: Action[] = $state([])
|
||||||
let input = $state<HTMLInputElement>()
|
let input = $state<HTMLInputElement>()
|
||||||
|
|
||||||
function fuzzySearch(text: string, pattern: string): number {
|
|
||||||
const textLower = text.toLowerCase()
|
|
||||||
const patternLower = pattern.toLowerCase()
|
|
||||||
let score = 0
|
|
||||||
let lastIndex = -1
|
|
||||||
let consecutiveBonus = 0
|
|
||||||
|
|
||||||
for (let i = 0; i < patternLower.length; i++) {
|
|
||||||
const index = textLower.indexOf(patternLower[i], lastIndex + 1)
|
|
||||||
if (index === -1) return 0
|
|
||||||
|
|
||||||
score += 1
|
|
||||||
if (index === lastIndex + 1) {
|
|
||||||
consecutiveBonus++
|
|
||||||
score += consecutiveBonus
|
|
||||||
} else {
|
|
||||||
consecutiveBonus = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
lastIndex = index
|
|
||||||
}
|
|
||||||
|
|
||||||
// Bonus for matching start of words
|
|
||||||
if (textLower.startsWith(patternLower)) {
|
|
||||||
score += 2
|
|
||||||
} else if (textLower.includes(' ' + patternLower)) {
|
|
||||||
score += 1
|
|
||||||
}
|
|
||||||
|
|
||||||
return score
|
|
||||||
}
|
|
||||||
|
|
||||||
const debounce = (fn: Function, ms = 300) => {
|
const debounce = (fn: Function, ms = 300) => {
|
||||||
let timeoutId: ReturnType<typeof setTimeout>
|
let timeoutId: ReturnType<typeof setTimeout>
|
||||||
// eslint-disable-next-line
|
// eslint-disable-next-line
|
||||||
|
|||||||
@@ -333,7 +333,13 @@
|
|||||||
"resolvedBy": "Resolved by",
|
"resolvedBy": "Resolved by",
|
||||||
"markAll": "Mark page resolved",
|
"markAll": "Mark page resolved",
|
||||||
"markAllComplete": "Batch action completed.",
|
"markAllComplete": "Batch action completed.",
|
||||||
"reports": "Reports"
|
"feed": "Reports",
|
||||||
|
"manage": {
|
||||||
|
"title": "Manage",
|
||||||
|
"modlogs": "Recent moderation logs",
|
||||||
|
"ban": "Ban",
|
||||||
|
"unban": "Unban"
|
||||||
|
}
|
||||||
},
|
},
|
||||||
"admin": {
|
"admin": {
|
||||||
"title": "Administration",
|
"title": "Administration",
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import type {
|
|||||||
Post,
|
Post,
|
||||||
PostReportView,
|
PostReportView,
|
||||||
PostView,
|
PostView,
|
||||||
|
PrivateMessage,
|
||||||
PrivateMessageReportView,
|
PrivateMessageReportView,
|
||||||
PrivateMessageView,
|
PrivateMessageView,
|
||||||
} from 'lemmy-js-client'
|
} from 'lemmy-js-client'
|
||||||
@@ -25,6 +26,7 @@ export type Result =
|
|||||||
| PostReportView
|
| PostReportView
|
||||||
| CommentReportView
|
| CommentReportView
|
||||||
| PrivateMessageReportView
|
| PrivateMessageReportView
|
||||||
|
| PrivateMessage
|
||||||
|
|
||||||
export function getItemPublished(item: Result) {
|
export function getItemPublished(item: Result) {
|
||||||
// reports... why
|
// reports... why
|
||||||
|
|||||||
@@ -186,3 +186,35 @@ export function escapeHtml(input: string): string {
|
|||||||
.replace(/"/g, '"')
|
.replace(/"/g, '"')
|
||||||
.replace(/'/g, ''')
|
.replace(/'/g, ''')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
export function fuzzySearch(text: string, pattern: string): number {
|
||||||
|
const textLower = text.toLowerCase()
|
||||||
|
const patternLower = pattern.toLowerCase()
|
||||||
|
let score = 0
|
||||||
|
let lastIndex = -1
|
||||||
|
let consecutiveBonus = 0
|
||||||
|
|
||||||
|
for (let i = 0; i < patternLower.length; i++) {
|
||||||
|
const index = textLower.indexOf(patternLower[i], lastIndex + 1)
|
||||||
|
if (index === -1) return 0
|
||||||
|
|
||||||
|
score += 1
|
||||||
|
if (index === lastIndex + 1) {
|
||||||
|
consecutiveBonus++
|
||||||
|
score += consecutiveBonus
|
||||||
|
} else {
|
||||||
|
consecutiveBonus = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
lastIndex = index
|
||||||
|
}
|
||||||
|
|
||||||
|
// Bonus for matching start of words
|
||||||
|
if (textLower.startsWith(patternLower)) {
|
||||||
|
score += 2
|
||||||
|
} else if (textLower.includes(' ' + patternLower)) {
|
||||||
|
score += 1
|
||||||
|
}
|
||||||
|
|
||||||
|
return score
|
||||||
|
}
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { Material, Popover } from 'mono-svelte'
|
||||||
|
import { Icon, Sparkles } from 'svelte-hero-icons'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Popover placement="left">
|
||||||
|
{#snippet target()}
|
||||||
|
<button
|
||||||
|
class="potato p-4 rounded-full border border-slate-200 dark:border-zinc-800 cursor-pointer pointer-events-auto"
|
||||||
|
>
|
||||||
|
<Icon src={Sparkles} size="32" />
|
||||||
|
</button>
|
||||||
|
{/snippet}
|
||||||
|
{#snippet popover()}
|
||||||
|
<Material color="uniform" rounding="2xl">
|
||||||
|
<h1 class="font-bold text-3xl">AI !!!!</h1>
|
||||||
|
</Material>
|
||||||
|
{/snippet}
|
||||||
|
</Popover>
|
||||||
|
|
||||||
|
<style>
|
||||||
|
.potato {
|
||||||
|
background: linear-gradient(
|
||||||
|
30deg,
|
||||||
|
color-mix(
|
||||||
|
in srgb,
|
||||||
|
var(--color-zinc-900) 90%,
|
||||||
|
var(--color-purple-400) 10%
|
||||||
|
),
|
||||||
|
color-mix(in srgb, var(--color-zinc-900) 90%, var(--color-blue-400) 10%)
|
||||||
|
);
|
||||||
|
}
|
||||||
|
</style>
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import Tabs from '$lib/components/ui/layout/pages/Tabs.svelte'
|
||||||
|
import { t } from '$lib/i18n/translations'
|
||||||
|
|
||||||
|
let { children } = $props()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<svelte:head>
|
||||||
|
<title>{$t('routes.moderation.title')}</title>
|
||||||
|
</svelte:head>
|
||||||
|
|
||||||
|
<div class="w-full space-y-4 pb-8">
|
||||||
|
<div
|
||||||
|
class="sticky w-max mx-auto z-50 max-w-full min-w-0 flex items-center gap-2 top-6 lg:top-22"
|
||||||
|
>
|
||||||
|
<Tabs
|
||||||
|
class="overflow-auto"
|
||||||
|
routes={[
|
||||||
|
{
|
||||||
|
href: '/moderation',
|
||||||
|
name: $t('routes.moderation.feed'),
|
||||||
|
},
|
||||||
|
{
|
||||||
|
href: '/moderation/communities',
|
||||||
|
name: $t('routes.communities.title'),
|
||||||
|
},
|
||||||
|
]}
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
{@render children?.()}
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,6 @@
|
|||||||
|
import { profile } from '$lib/auth.svelte'
|
||||||
|
import { error } from '@sveltejs/kit'
|
||||||
|
|
||||||
|
export function load() {
|
||||||
|
if (!profile.data.jwt) error(401)
|
||||||
|
}
|
||||||
@@ -7,13 +7,14 @@
|
|||||||
import { t } from '$lib/i18n/translations'
|
import { t } from '$lib/i18n/translations'
|
||||||
import { client } from '$lib/lemmy.svelte'
|
import { client } from '$lib/lemmy.svelte'
|
||||||
import { searchParam } from '$lib/util.svelte.js'
|
import { searchParam } from '$lib/util.svelte.js'
|
||||||
import { Button, Select, toast } from 'mono-svelte'
|
import { Button, Material, Select, Spinner, toast } from 'mono-svelte'
|
||||||
import Option from 'mono-svelte/forms/select/Option.svelte'
|
import Option from 'mono-svelte/forms/select/Option.svelte'
|
||||||
import { tick } from 'svelte'
|
import { tick } from 'svelte'
|
||||||
import { Check, Funnel, Icon, Inbox } from 'svelte-hero-icons'
|
import { Check, Funnel, Icon, Inbox, XMark } from 'svelte-hero-icons'
|
||||||
import { fly } from 'svelte/transition'
|
import { fly } from 'svelte/transition'
|
||||||
import Report from './Report.svelte'
|
import Report from './Report.svelte'
|
||||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||||
|
import CommunityLink from '$lib/components/lemmy/community/CommunityLink.svelte'
|
||||||
|
|
||||||
let { data = $bindable() } = $props()
|
let { data = $bindable() } = $props()
|
||||||
|
|
||||||
@@ -26,38 +27,40 @@
|
|||||||
|
|
||||||
await Promise.all(
|
await Promise.all(
|
||||||
data.items?.value.map(report => {
|
data.items?.value.map(report => {
|
||||||
switch (report.type) {
|
report.map(r => {
|
||||||
case 'comment': {
|
switch (r.type) {
|
||||||
const promise = client().resolveCommentReport({
|
case 'comment': {
|
||||||
report_id: report.id,
|
const promise = client().resolveCommentReport({
|
||||||
resolved: true,
|
report_id: r.id,
|
||||||
})
|
resolved: true,
|
||||||
promise.then(
|
})
|
||||||
() => (batch.progress += 1 / data.items?.value!.length),
|
promise.then(
|
||||||
)
|
() => (batch.progress += 1 / data.items?.value!.length),
|
||||||
return promise
|
)
|
||||||
|
return promise
|
||||||
|
}
|
||||||
|
case 'post': {
|
||||||
|
const promise = client().resolvePostReport({
|
||||||
|
report_id: r.id,
|
||||||
|
resolved: true,
|
||||||
|
})
|
||||||
|
promise.then(
|
||||||
|
() => (batch.progress += 1 / data.items?.value!.length),
|
||||||
|
)
|
||||||
|
return promise
|
||||||
|
}
|
||||||
|
case 'message': {
|
||||||
|
const promise = client().resolvePrivateMessageReport({
|
||||||
|
report_id: r.id,
|
||||||
|
resolved: true,
|
||||||
|
})
|
||||||
|
promise.then(
|
||||||
|
() => (batch.progress += 1 / data.items?.value!.length),
|
||||||
|
)
|
||||||
|
return promise
|
||||||
|
}
|
||||||
}
|
}
|
||||||
case 'post': {
|
})
|
||||||
const promise = client().resolvePostReport({
|
|
||||||
report_id: report.id,
|
|
||||||
resolved: true,
|
|
||||||
})
|
|
||||||
promise.then(
|
|
||||||
() => (batch.progress += 1 / data.items?.value!.length),
|
|
||||||
)
|
|
||||||
return promise
|
|
||||||
}
|
|
||||||
case 'message': {
|
|
||||||
const promise = client().resolvePrivateMessageReport({
|
|
||||||
report_id: report.id,
|
|
||||||
resolved: true,
|
|
||||||
})
|
|
||||||
promise.then(
|
|
||||||
() => (batch.progress += 1 / data.items?.value!.length),
|
|
||||||
)
|
|
||||||
return promise
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}),
|
}),
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -101,6 +104,30 @@
|
|||||||
{$t('routes.moderation.markAll')}
|
{$t('routes.moderation.markAll')}
|
||||||
</Button>
|
</Button>
|
||||||
</div>
|
</div>
|
||||||
|
{#if data.filters.community}
|
||||||
|
<ul class="font-normal flex flex-col gap-2 mt-2">
|
||||||
|
<li>
|
||||||
|
<span class="text-sm text-slate-600 dark:text-zinc-400">
|
||||||
|
{$t('form.post.community')}
|
||||||
|
</span>
|
||||||
|
{#await client().getCommunity({ id: data.filters.community })}
|
||||||
|
<Spinner width={24} />
|
||||||
|
{:then community}
|
||||||
|
<a
|
||||||
|
class="inline"
|
||||||
|
aria-label={$t('common.remove')}
|
||||||
|
href="?community="
|
||||||
|
>
|
||||||
|
<Icon src={XMark} size="16" micro class="inline" />
|
||||||
|
</a>
|
||||||
|
<CommunityLink
|
||||||
|
class="w-max inline"
|
||||||
|
community={community.community_view.community}
|
||||||
|
/>
|
||||||
|
{/await}
|
||||||
|
</li>
|
||||||
|
</ul>
|
||||||
|
{/if}
|
||||||
{/snippet}
|
{/snippet}
|
||||||
</Header>
|
</Header>
|
||||||
</div>
|
</div>
|
||||||
@@ -109,14 +136,27 @@
|
|||||||
<div
|
<div
|
||||||
class="flex flex-col *:py-4 divide-y divide-slate-200 dark:divide-zinc-800"
|
class="flex flex-col *:py-4 divide-y divide-slate-200 dark:divide-zinc-800"
|
||||||
>
|
>
|
||||||
{#each data.items?.value as item (item.id)}
|
{#each data.items?.value as item}
|
||||||
<div
|
<div
|
||||||
in:fly={{ y: -6, opacity: 0, duration: 500 }}
|
in:fly={{ y: -6, opacity: 0, duration: 500 }}
|
||||||
class="flex flex-col gap-3 text-sm -mx-4 sm:-mx-6 px-4 sm:px-6"
|
class="flex flex-col gap-3 text-sm -mx-4 sm:-mx-6 px-4 sm:px-6 items-center"
|
||||||
>
|
>
|
||||||
<div class="space-y-2">
|
<Material
|
||||||
|
rounding={item.length == 1 ? 'none' : '2xl'}
|
||||||
|
color={item.length == 1 ? 'none' : 'uniform'}
|
||||||
|
padding={item.length == 1 ? 'none' : 'md'}
|
||||||
|
class={['space-y-2 w-full']}
|
||||||
|
>
|
||||||
<Report {item} />
|
<Report {item} />
|
||||||
</div>
|
</Material>
|
||||||
|
{#if item.length > 1}
|
||||||
|
<Material
|
||||||
|
padding="none"
|
||||||
|
rounding="none"
|
||||||
|
color="uniform"
|
||||||
|
class="-mt-3 rounded-b-2xl w-[95%] h-4 bg-slate-50! dark:bg-zinc-950!"
|
||||||
|
></Material>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
{/each}
|
{/each}
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -1,10 +1,12 @@
|
|||||||
import { profile } from '$lib/auth.svelte'
|
import { profile } from '$lib/auth.svelte'
|
||||||
import { isAdmin } from '$lib/components/lemmy/moderation/moderation.js'
|
import { isAdmin } from '$lib/components/lemmy/moderation/moderation.js'
|
||||||
import { getClient } from '$lib/lemmy.svelte.js'
|
import { getClient } from '$lib/lemmy.svelte.js'
|
||||||
|
import { isCommentView, isPostView } from '$lib/lemmy/item'
|
||||||
import {
|
import {
|
||||||
generalizeCommentReport,
|
generalizeCommentReport,
|
||||||
generalizePostReport,
|
generalizePostReport,
|
||||||
generalizePrivateMessageReport,
|
generalizePrivateMessageReport,
|
||||||
|
type ReportView,
|
||||||
} from '$lib/lemmy/report.js'
|
} from '$lib/lemmy/report.js'
|
||||||
import { ReactiveState } from '$lib/promise.svelte'
|
import { ReactiveState } from '$lib/promise.svelte'
|
||||||
import { error } from '@sveltejs/kit'
|
import { error } from '@sveltejs/kit'
|
||||||
@@ -17,20 +19,15 @@ export async function load({ url, fetch }) {
|
|||||||
const page = Number(url.searchParams.get('page')) || 1
|
const page = Number(url.searchParams.get('page')) || 1
|
||||||
const type: ReportListType =
|
const type: ReportListType =
|
||||||
(url.searchParams.get('type') as ReportListType) || 'unread'
|
(url.searchParams.get('type') as ReportListType) || 'unread'
|
||||||
|
const community = Number(url.searchParams.get('community')) || undefined
|
||||||
|
|
||||||
// can they please
|
|
||||||
// make a sane, consistent, and simple API for once
|
|
||||||
// 3 separate requests? really?
|
|
||||||
// and this time instead of get() it's list(). Why?!
|
|
||||||
// the interfaces don't even extend each other
|
|
||||||
// meaning I have to make a separate function to get dates
|
|
||||||
// for EACH FREAKING ITEM KAJSHDAWLD auwdi awiody
|
|
||||||
const client = getClient(undefined, fetch)
|
const client = getClient(undefined, fetch)
|
||||||
|
|
||||||
const params = {
|
const params = {
|
||||||
limit: 20,
|
limit: 20,
|
||||||
page: page,
|
page: page,
|
||||||
unresolved_only: type == 'unread',
|
unresolved_only: type == 'unread',
|
||||||
|
community_id: community,
|
||||||
}
|
}
|
||||||
|
|
||||||
const admin = profile.data?.user ? isAdmin(profile!.data.user!) : false
|
const admin = profile.data?.user ? isAdmin(profile!.data.user!) : false
|
||||||
@@ -53,9 +50,28 @@ export async function load({ url, fetch }) {
|
|||||||
),
|
),
|
||||||
].sort((a, b) => b.timestamp.getTime() - a.timestamp.getTime())
|
].sort((a, b) => b.timestamp.getTime() - a.timestamp.getTime())
|
||||||
|
|
||||||
|
const grouped = everything.reduce(
|
||||||
|
(groups, item) => {
|
||||||
|
const key = isPostView(item.item)
|
||||||
|
? item.item.post.id
|
||||||
|
: isCommentView(item.item)
|
||||||
|
? item.item.comment.id
|
||||||
|
: item.item.id
|
||||||
|
if (!groups[key]) {
|
||||||
|
groups[key] = []
|
||||||
|
}
|
||||||
|
groups[key].push(item)
|
||||||
|
return groups
|
||||||
|
},
|
||||||
|
{} as Record<number, ReportView[]>,
|
||||||
|
)
|
||||||
|
|
||||||
return {
|
return {
|
||||||
type: new ReactiveState(type),
|
type: new ReactiveState(type),
|
||||||
page: page,
|
page: page,
|
||||||
items: new ReactiveState(everything),
|
items: new ReactiveState(Object.values(grouped)),
|
||||||
|
filters: {
|
||||||
|
community: community,
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,19 +4,23 @@
|
|||||||
import PrivateMessage from '$lib/components/lemmy/inbox/PrivateMessage.svelte'
|
import PrivateMessage from '$lib/components/lemmy/inbox/PrivateMessage.svelte'
|
||||||
import Post from '$lib/components/lemmy/post/Post.svelte'
|
import Post from '$lib/components/lemmy/post/Post.svelte'
|
||||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||||
|
import Avatar from '$lib/components/ui/Avatar.svelte'
|
||||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||||
import { t } from '$lib/i18n/translations'
|
import { t } from '$lib/i18n/translations'
|
||||||
import { getClient } from '$lib/lemmy.svelte.js'
|
import { getClient } from '$lib/lemmy.svelte.js'
|
||||||
import { errorMessage } from '$lib/lemmy/error'
|
import { errorMessage } from '$lib/lemmy/error'
|
||||||
import type { ReportView } from '$lib/lemmy/report.js'
|
import type { ReportView } from '$lib/lemmy/report.js'
|
||||||
import { Button, Material, toast } from 'mono-svelte'
|
import { Badge, Button, Material, Modal, toast } from 'mono-svelte'
|
||||||
import { CheckCircle, Icon } from 'svelte-hero-icons'
|
import { CheckCircle, Icon } from 'svelte-hero-icons'
|
||||||
|
|
||||||
interface Props {
|
interface Props {
|
||||||
item: ReportView
|
item: ReportView[]
|
||||||
}
|
}
|
||||||
|
|
||||||
let { item = $bindable() }: Props = $props()
|
let { item: items = $bindable() }: Props = $props()
|
||||||
|
|
||||||
|
// TODO more strict type enforcing, this hack is not good
|
||||||
|
const item = items[0]
|
||||||
|
|
||||||
let resolving = $state(false)
|
let resolving = $state(false)
|
||||||
async function resolve() {
|
async function resolve() {
|
||||||
@@ -26,63 +30,72 @@
|
|||||||
try {
|
try {
|
||||||
switch (item.type) {
|
switch (item.type) {
|
||||||
case 'comment': {
|
case 'comment': {
|
||||||
const res = await getClient().resolveCommentReport({
|
await Promise.all(
|
||||||
report_id: item.id,
|
items.map(async i =>
|
||||||
resolved: !item.resolved,
|
getClient()
|
||||||
})
|
.resolveCommentReport({
|
||||||
|
report_id: i.id,
|
||||||
item.resolved = res.comment_report_view.comment_report.resolved
|
resolved: !i.resolved,
|
||||||
item.resolver = res.comment_report_view.resolver
|
})
|
||||||
|
.then(res => {
|
||||||
toast({
|
i.resolved = res.comment_report_view.comment_report.resolved
|
||||||
content: item.resolved
|
i.resolver = res.comment_report_view.resolver
|
||||||
? $t('toast.resolveReport')
|
$notifications.reports += i.resolved ? 1 : -1
|
||||||
: $t('toast.unresolveReport'),
|
}),
|
||||||
type: 'success',
|
),
|
||||||
})
|
)
|
||||||
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case 'post': {
|
case 'post': {
|
||||||
const res = await getClient().resolvePostReport({
|
await Promise.all(
|
||||||
report_id: item.id,
|
items.map(async i =>
|
||||||
resolved: !item.resolved,
|
getClient()
|
||||||
})
|
.resolvePostReport({
|
||||||
|
report_id: i.id,
|
||||||
|
resolved: !i.resolved,
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
i.resolved = res.post_report_view.post_report.resolved
|
||||||
|
|
||||||
item.resolved = res.post_report_view.post_report.resolved
|
i.resolver = res.post_report_view.resolver
|
||||||
item.resolver = res.post_report_view.resolver
|
|
||||||
toast({
|
$notifications.reports += i.resolved ? 1 : -1
|
||||||
content: item.resolved
|
}),
|
||||||
? $t('toast.resolveReport')
|
),
|
||||||
: $t('toast.unresolveReport'),
|
)
|
||||||
type: 'success',
|
|
||||||
})
|
|
||||||
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
case 'message': {
|
case 'message': {
|
||||||
const res = await getClient().resolvePrivateMessageReport({
|
await Promise.all(
|
||||||
report_id: item.id,
|
items.map(async i =>
|
||||||
resolved: !item.resolved,
|
getClient()
|
||||||
})
|
.resolvePrivateMessageReport({
|
||||||
|
report_id: i.id,
|
||||||
|
resolved: !i.resolved,
|
||||||
|
})
|
||||||
|
.then(res => {
|
||||||
|
i.resolved =
|
||||||
|
res.private_message_report_view.private_message_report.resolved
|
||||||
|
|
||||||
item.resolved =
|
i.resolver = res.private_message_report_view.resolver
|
||||||
res.private_message_report_view.private_message_report.resolved
|
|
||||||
|
|
||||||
item.resolver = res.private_message_report_view.resolver
|
$notifications.reports += i.resolved ? 1 : -1
|
||||||
|
}),
|
||||||
toast({
|
),
|
||||||
content: item.resolved
|
)
|
||||||
? $t('toast.resolveReport')
|
|
||||||
: $t('toast.unresolveReport'),
|
|
||||||
type: 'success',
|
|
||||||
})
|
|
||||||
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$notifications.reports += item.resolved ? 1 : -1
|
toast({
|
||||||
|
content: item.resolved
|
||||||
|
? $t('toast.resolveReport')
|
||||||
|
: $t('toast.unresolveReport'),
|
||||||
|
type: 'success',
|
||||||
|
})
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
toast({
|
toast({
|
||||||
content: errorMessage(err as string),
|
content: errorMessage(err as string),
|
||||||
@@ -92,16 +105,69 @@
|
|||||||
|
|
||||||
resolving = false
|
resolving = false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let usersModal = $state(false)
|
||||||
|
let reasonsModal = $state(false)
|
||||||
</script>
|
</script>
|
||||||
|
|
||||||
<div class="flex flex-row">
|
<Modal title="Report from" bind:open={usersModal}>
|
||||||
<div class="flex flex-col gap-1.5 flex-1">
|
<div class="flex flex-col divide-y divide-slate-200 dark:divide-zinc-800">
|
||||||
<span class="text-xs font-medium">Report from</span>
|
{#each items as item}
|
||||||
<span class="font-bold">
|
<UserLink avatar={false} user={item.creator} class="py-1" />
|
||||||
<UserLink avatar user={item.creator} />
|
{/each}
|
||||||
</span>
|
|
||||||
</div>
|
</div>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
<Modal title={$t('moderation.reason')} bind:open={reasonsModal}>
|
||||||
|
<div class="flex flex-col divide-y divide-slate-200 dark:divide-zinc-800">
|
||||||
|
{#each items as item}
|
||||||
|
<div class="py-2">
|
||||||
|
<UserLink avatar={false} user={item.creator} class="py-1 block" />
|
||||||
|
<blockquote
|
||||||
|
class="italic text-sm pl-4 border-l-2 border-slate-300 dark:border-zinc-700"
|
||||||
|
>
|
||||||
|
{item.reason}
|
||||||
|
</blockquote>
|
||||||
|
</div>
|
||||||
|
{/each}
|
||||||
|
</div>
|
||||||
|
</Modal>
|
||||||
|
|
||||||
|
<div class={['flex flex-row flex-wrap gap-4']}>
|
||||||
|
{#if item.type == 'comment' || item.type == 'post'}
|
||||||
|
<div class="flex flex-col gap-1.5">
|
||||||
|
<span class="text-xs font-medium">{$t('form.post.community')}</span>
|
||||||
|
<a
|
||||||
|
href="?community={item.item.community.id}"
|
||||||
|
class="flex items-center gap-1 font-medium hover:underline"
|
||||||
|
>
|
||||||
|
<Avatar
|
||||||
|
circle={false}
|
||||||
|
url={item.item.community.icon}
|
||||||
|
alt={item.item.community.name}
|
||||||
|
width={24}
|
||||||
|
/>
|
||||||
|
{item.item.community.title}
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
{#if items.length > 1}
|
||||||
|
<button
|
||||||
|
onclick={() => (usersModal = !usersModal)}
|
||||||
|
class="flex-1 text-2xl font-medium hover:underline cursor-pointer text-left w-max"
|
||||||
|
>
|
||||||
|
{items.length}x
|
||||||
|
</button>
|
||||||
|
{:else}
|
||||||
|
<div class="flex flex-col gap-1.5">
|
||||||
|
<span class="text-xs font-medium">Report from</span>
|
||||||
|
<span class="font-bold">
|
||||||
|
<UserLink avatar user={item.creator} />
|
||||||
|
</span>
|
||||||
|
</div>
|
||||||
|
{/if}
|
||||||
|
|
||||||
|
<div class="flex-1"></div>
|
||||||
<Button
|
<Button
|
||||||
onclick={resolve}
|
onclick={resolve}
|
||||||
class="h-max self-end {item.resolved
|
class="h-max self-end {item.resolved
|
||||||
@@ -123,9 +189,9 @@
|
|||||||
|
|
||||||
<Material rounding="xl" color="uniform" class="dark:bg-zinc-950">
|
<Material rounding="xl" color="uniform" class="dark:bg-zinc-950">
|
||||||
{#if item.type == 'comment'}
|
{#if item.type == 'comment'}
|
||||||
<CommentItem community={true} comment={item.item} class="p-0!" />
|
<CommentItem comment={item.item} class="p-0!" />
|
||||||
{:else if item.type == 'post'}
|
{:else if item.type == 'post'}
|
||||||
<Post post={item.item} class="p-0!" />
|
<Post hideCommunity post={item.item} class="p-0!" />
|
||||||
{:else if item.type == 'message'}
|
{:else if item.type == 'message'}
|
||||||
<PrivateMessage
|
<PrivateMessage
|
||||||
message={{
|
message={{
|
||||||
@@ -145,7 +211,16 @@
|
|||||||
<p>
|
<p>
|
||||||
{item.reason}
|
{item.reason}
|
||||||
</p>
|
</p>
|
||||||
|
{#if items.length > 1}
|
||||||
|
<button
|
||||||
|
class="cursor-pointer"
|
||||||
|
onclick={() => (reasonsModal = !reasonsModal)}
|
||||||
|
>
|
||||||
|
<Badge class="w-max my-1">+{items.length - 1}</Badge>
|
||||||
|
</button>
|
||||||
|
{/if}
|
||||||
</div>
|
</div>
|
||||||
|
<div class="flex-1"></div>
|
||||||
{#if item.resolver}
|
{#if item.resolver}
|
||||||
<div>
|
<div>
|
||||||
<SectionTitle small>
|
<SectionTitle small>
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import CommunityHeader from '$lib/components/lemmy/community/CommunityHeader.svelte'
|
||||||
|
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||||
|
import { t } from '$lib/i18n/translations'
|
||||||
|
import { Button, Material, Spinner } from 'mono-svelte'
|
||||||
|
import ModlogItemCard from '../../../modlog/item/ModlogItemCard.svelte'
|
||||||
|
import Expandable from '$lib/components/ui/Expandable.svelte'
|
||||||
|
import UserAutocomplete from '$lib/components/lemmy/user/UserAutocomplete.svelte'
|
||||||
|
import { ban } from '$lib/components/lemmy/moderation/moderation'
|
||||||
|
import Switch from '$lib/components/input/Switch.svelte'
|
||||||
|
|
||||||
|
let banFromCommunity = $state(false)
|
||||||
|
|
||||||
|
let { data } = $props()
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Header pageHeader>
|
||||||
|
{#snippet extended()}
|
||||||
|
<CommunityHeader
|
||||||
|
community={data.community.community_view.community}
|
||||||
|
counts={data.community.community_view.counts}
|
||||||
|
moderators={data.community.moderators}
|
||||||
|
subscribed={data.community.community_view.subscribed}
|
||||||
|
banner={false}
|
||||||
|
/>
|
||||||
|
{/snippet}
|
||||||
|
</Header>
|
||||||
|
|
||||||
|
<div
|
||||||
|
class="flex flex-col *:py-2 divide-y divide-slate-200 dark:divide-zinc-800"
|
||||||
|
>
|
||||||
|
<Expandable>
|
||||||
|
{#snippet title()}
|
||||||
|
{$t('routes.moderation.manage.modlogs')}
|
||||||
|
{/snippet}
|
||||||
|
<Material
|
||||||
|
color="uniform"
|
||||||
|
rounding="2xl"
|
||||||
|
class="dark:bg-zinc-950 max-h-96 h-full overflow-auto space-y-4 mt-1"
|
||||||
|
>
|
||||||
|
{#await data.modlog}
|
||||||
|
<Spinner width={24} />
|
||||||
|
{:then log}
|
||||||
|
{#each log as modLog}
|
||||||
|
<ModlogItemCard item={modLog} />
|
||||||
|
{/each}
|
||||||
|
<div
|
||||||
|
class="sticky -bottom-4 pb-4 w-full flex items-center bg-gradient-to-b from-white/0 to-white dark:from-zinc-950/0 dark:to-zinc-950"
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
color="primary"
|
||||||
|
rounding="pill"
|
||||||
|
class="mx-auto"
|
||||||
|
href="/modlog?community={data.community.community_view.community
|
||||||
|
.id}"
|
||||||
|
>
|
||||||
|
{$t('form.post.readMore')}
|
||||||
|
</Button>
|
||||||
|
</div>
|
||||||
|
{/await}
|
||||||
|
</Material>
|
||||||
|
</Expandable>
|
||||||
|
<Expandable>
|
||||||
|
{#snippet title()}
|
||||||
|
<div>
|
||||||
|
{$t('moderation.ban.banFromCommunity')}
|
||||||
|
</div>
|
||||||
|
{/snippet}
|
||||||
|
<div class="flex flex-col gap-4">
|
||||||
|
<Switch
|
||||||
|
options={[false, true]}
|
||||||
|
optionNames={[
|
||||||
|
$t('routes.moderation.manage.ban'),
|
||||||
|
$t('routes.moderation.manage.unban'),
|
||||||
|
]}
|
||||||
|
bind:selected={banFromCommunity}
|
||||||
|
/>
|
||||||
|
<UserAutocomplete
|
||||||
|
onselect={p =>
|
||||||
|
ban(banFromCommunity, p, data.community.community_view.community)}
|
||||||
|
listing_type="All"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</Expandable>
|
||||||
|
</div>
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
import { client } from '$lib/lemmy.svelte.js'
|
||||||
|
import { _toModLog } from '../../../modlog/+page.js'
|
||||||
|
|
||||||
|
export async function load({ params, fetch }) {
|
||||||
|
const modlog = client({ func: fetch })
|
||||||
|
.getModlog({
|
||||||
|
community_id: Number(params.id),
|
||||||
|
limit: 5,
|
||||||
|
page: 1,
|
||||||
|
})
|
||||||
|
.then(i =>
|
||||||
|
[
|
||||||
|
...i.banned_from_community,
|
||||||
|
...i.removed_comments,
|
||||||
|
...i.removed_posts,
|
||||||
|
|
||||||
|
...i.added_to_community,
|
||||||
|
...i.transferred_to_community,
|
||||||
|
|
||||||
|
...i.featured_posts,
|
||||||
|
...i.locked_posts,
|
||||||
|
|
||||||
|
...i.admin_purged_comments,
|
||||||
|
...i.admin_purged_communities,
|
||||||
|
...i.admin_purged_posts,
|
||||||
|
...i.admin_purged_persons,
|
||||||
|
|
||||||
|
...i.hidden_communities,
|
||||||
|
...i.banned,
|
||||||
|
...i.added,
|
||||||
|
]
|
||||||
|
.map(_toModLog)
|
||||||
|
.toSorted((a, b) => b.timestamp - a.timestamp),
|
||||||
|
)
|
||||||
|
|
||||||
|
const community = await client({ func: fetch }).getCommunity({
|
||||||
|
id: Number(params.id),
|
||||||
|
})
|
||||||
|
|
||||||
|
return {
|
||||||
|
community: community,
|
||||||
|
modlog: modlog,
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,73 @@
|
|||||||
|
<script lang="ts">
|
||||||
|
import { profile } from '$lib/auth.svelte'
|
||||||
|
import CommunityItem from '$lib/components/lemmy/community/CommunityItem.svelte'
|
||||||
|
import Header from '$lib/components/ui/layout/pages/Header.svelte'
|
||||||
|
import { t } from '$lib/i18n/translations'
|
||||||
|
import { Button, Material, Spinner } from 'mono-svelte'
|
||||||
|
</script>
|
||||||
|
|
||||||
|
<Header pageHeader>
|
||||||
|
{$t('nav.communities')}
|
||||||
|
</Header>
|
||||||
|
<div class="w-full h-full flex flex-col mt-4">
|
||||||
|
{#if !profile.data.user}
|
||||||
|
<div class="mx-auto my-auto">
|
||||||
|
<Spinner width={24} />
|
||||||
|
</div>
|
||||||
|
{:else}
|
||||||
|
<Material
|
||||||
|
color="uniform"
|
||||||
|
rounding="2xl"
|
||||||
|
class="flex flex-col dark:bg-zinc-950 max-h-[32rem] overflow-auto"
|
||||||
|
>
|
||||||
|
{#each profile.data.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"
|
||||||
|
>
|
||||||
|
<CommunityItem
|
||||||
|
community={{
|
||||||
|
banned_from_community: false,
|
||||||
|
blocked: false,
|
||||||
|
community: community,
|
||||||
|
counts: {
|
||||||
|
comments: 0,
|
||||||
|
community_id: 0,
|
||||||
|
posts: 0,
|
||||||
|
published: '2023-10-05',
|
||||||
|
subscribers: 0,
|
||||||
|
subscribers_local: 0,
|
||||||
|
users_active_day: 0,
|
||||||
|
users_active_half_year: 0,
|
||||||
|
users_active_month: 0,
|
||||||
|
users_active_week: 0,
|
||||||
|
},
|
||||||
|
subscribed: 'NotSubscribed',
|
||||||
|
}}
|
||||||
|
class="py-1 -mx-4 px-4"
|
||||||
|
>
|
||||||
|
<Button
|
||||||
|
href="/moderation?community={community.id}"
|
||||||
|
color="secondary"
|
||||||
|
rounding="pill"
|
||||||
|
size="sm"
|
||||||
|
class="h-max self-center"
|
||||||
|
>
|
||||||
|
{$t('routes.moderation.feed')}
|
||||||
|
</Button>
|
||||||
|
<div class="w-2"></div>
|
||||||
|
<Button
|
||||||
|
href="/moderation/c/{community.id}"
|
||||||
|
color="primary"
|
||||||
|
rounding="pill"
|
||||||
|
size="sm"
|
||||||
|
class="h-max self-center"
|
||||||
|
>
|
||||||
|
{$t('routes.moderation.manage.title')}
|
||||||
|
</Button>
|
||||||
|
</CommunityItem>
|
||||||
|
</div>
|
||||||
|
{/each}
|
||||||
|
</Material>
|
||||||
|
{/if}
|
||||||
|
</div>
|
||||||
Reference in new issue
Block a user