impr: moderation experience (#587)

* feat: display filters on the top

* feat: add grid view for modlog cards

* misc: add user modlog button

* fix: add pageination to moderation page

* feat: make reply reason save
This commit is contained in:
Xylight authored and GitHub committed 2025-06-17 20:49:07 -07:00
1 parent 02b4c72233
commit 4e88f11ced
15 files changed
+193 -31

No files matched your search

@@ -13,6 +13,7 @@
instance?: string | undefined
listing_type?: ListingType
showWhenEmpty?: boolean
placeholder?: string
// eslint-disable-next-line
onselect?: (item: any) => void
}
+1 -1
View File
@@ -134,7 +134,7 @@
<div class="flex flex-row flex-wrap gap-1">
<Link highlight href="/modlog">
{$t('routes.modlog')}
{$t('routes.modlog.title')}
</Link>
•
<Link highlight href="/legal">
@@ -5,6 +5,7 @@
Fire,
Icon,
Megaphone,
Newspaper,
ShieldExclamation,
Trash,
} from 'svelte-hero-icons'
@@ -88,6 +89,18 @@
? $t('moderation.unfeature')
: $t('moderation.feature')}
</MenuButton>
<MenuButton color="success-subtle" href="/modlog?user={item.creator.id}">
<Icon src={Newspaper} size="16" micro />
{$t('moderation.modlog.user')}
</MenuButton>
<MenuButton
color="success-subtle"
href="/modlog?comment={item.comment.id}"
>
<Icon src={Newspaper} size="16" micro />
{$t('moderation.modlog.comment')}
</MenuButton>
{/if}
{/if}
@@ -11,6 +11,7 @@
LockClosed,
LockOpen,
Megaphone,
Newspaper,
ShieldExclamation,
Trash,
} from 'svelte-hero-icons'
@@ -148,6 +149,14 @@
? $t('moderation.ban.unbanFromCommunity')
: $t('moderation.ban.banFromCommunity')}
</MenuButton>
<MenuButton color="success-subtle" href="/modlog?user={item.creator.id}">
<Icon src={Newspaper} size="16" micro />
{$t('moderation.modlog.user')}
</MenuButton>
<MenuButton color="success-subtle" href="/modlog?post={item.post.id}">
<Icon src={Newspaper} size="16" micro />
{$t('moderation.modlog.post')}
</MenuButton>
{/if}
{/if}
{#if profile.data?.user && isAdmin(profile.data.user)}
@@ -32,11 +32,21 @@
}: Props = $props()
let reason = $state('')
let commentReason: boolean = $state(false)
let privateMessage: boolean = $state(false)
let commentReason: boolean = $state(
settings.moderation.defaultRemoveAction != null,
)
let privateMessage: boolean = $state(
settings.moderation.defaultRemoveAction == 'message',
)
let loading = $state(false)
let preset = $state(settings.moderation.presets[0]?.content ?? '')
$effect(() => {
if (!commentReason) settings.moderation.defaultRemoveAction = null
else if (privateMessage) settings.moderation.defaultRemoveAction = 'message'
else settings.moderation.defaultRemoveAction = 'comment'
})
let removed = $derived(
item
? isCommentView(item)
@@ -163,7 +173,6 @@
const resetText = () => {
reason = ''
commentReason = false
}
run(() => {
+10 -2
View File
@@ -207,7 +207,10 @@
"footer": "{{users:number}} active {{users; 1:user; default:users;}}",
"endFeed": "You have reached the end of {{community_name; undefined:the feed.; default:{{community_name}}.}}"
},
"modlog": "Modlog",
"modlog": {
"title": "Modlog",
"filters": "Filters"
},
"instances": "Instances",
"legal": {
"title": "Legal",
@@ -603,7 +606,12 @@
"labelInstanceOnly": "Moderation (Instance Only)",
"feature": "Feature",
"unfeature": "Unfeature",
"votes": "Votes"
"votes": "Votes",
"modlog": {
"user": "User moderation log",
"post": "Post moderation log",
"comment": "Comment moderation log"
}
},
"common": {
"back": "Back",
+3 -1
View File
@@ -59,6 +59,7 @@ interface Settings {
nsfwBlur: boolean
moderation: {
presets: Preset[]
defaultRemoveAction: 'comment' | 'message' | null
}
randomPlaceholders: boolean
modlogCardView: boolean | undefined
@@ -102,7 +103,7 @@ interface Settings {
}
export const defaultSettings: Settings = {
settingsVer: 4,
settingsVer: 5,
expandableImages: toBool(env.PUBLIC_EXPANDABLE_IMAGES) ?? true,
markReadPosts: toBool(env.PUBLIC_MARK_READ_POSTS) ?? true,
showInstances: {
@@ -138,6 +139,7 @@ export const defaultSettings: Settings = {
content: `Your submission in *"{{post}}"* was removed for {{reason}}.`,
},
],
defaultRemoveAction: null,
},
randomPlaceholders: toBool(env.PUBLIC_RANDOM_PLACEHOLDERS) ?? false,
modlogCardView: toBool(env.PUBLIC_MODLOG_CARD_VIEW) ?? undefined,