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
@@ -7,13 +7,14 @@
|
||||
import { t } from '$lib/i18n/translations'
|
||||
import { client } from '$lib/lemmy.svelte'
|
||||
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 { 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 Report from './Report.svelte'
|
||||
import Pageination from '$lib/components/ui/Pageination.svelte'
|
||||
import CommunityLink from '$lib/components/lemmy/community/CommunityLink.svelte'
|
||||
|
||||
let { data = $bindable() } = $props()
|
||||
|
||||
@@ -26,38 +27,40 @@
|
||||
|
||||
await Promise.all(
|
||||
data.items?.value.map(report => {
|
||||
switch (report.type) {
|
||||
case 'comment': {
|
||||
const promise = client().resolveCommentReport({
|
||||
report_id: report.id,
|
||||
resolved: true,
|
||||
})
|
||||
promise.then(
|
||||
() => (batch.progress += 1 / data.items?.value!.length),
|
||||
)
|
||||
return promise
|
||||
report.map(r => {
|
||||
switch (r.type) {
|
||||
case 'comment': {
|
||||
const promise = client().resolveCommentReport({
|
||||
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: 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')}
|
||||
</Button>
|
||||
</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}
|
||||
</Header>
|
||||
</div>
|
||||
@@ -109,14 +136,27 @@
|
||||
<div
|
||||
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
|
||||
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} />
|
||||
</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>
|
||||
{/each}
|
||||
</div>
|
||||
|
||||
Reference in new issue
Block a user