feat: show moderator who resolved report, close #395
This commit is contained in:
1 parent
c54969495b
commit
d8975e31a4
6 files changed
+61
-32
No files matched your search
@@ -21,21 +21,26 @@
|
||||
padding="none"
|
||||
>
|
||||
<div class="flex flex-row justify-between items-center gap-2">
|
||||
<PostMeta
|
||||
badges={{
|
||||
nsfw: comment.post.nsfw,
|
||||
removed: comment.post.removed,
|
||||
admin: false,
|
||||
moderator: false,
|
||||
saved: false,
|
||||
deleted: comment.post.deleted,
|
||||
featured:
|
||||
comment.post.featured_community || comment.post.featured_local,
|
||||
locked: comment.post.locked,
|
||||
}}
|
||||
published={publishedToDate(comment.comment.published)}
|
||||
community={community ? comment.community : undefined}
|
||||
/>
|
||||
<div class="flex flex-col gap-2">
|
||||
<PostMeta
|
||||
badges={{
|
||||
nsfw: comment.post.nsfw,
|
||||
removed: comment.post.removed,
|
||||
admin: false,
|
||||
moderator: false,
|
||||
saved: false,
|
||||
deleted: comment.post.deleted,
|
||||
featured:
|
||||
comment.post.featured_community || comment.post.featured_local,
|
||||
locked: comment.post.locked,
|
||||
}}
|
||||
published={publishedToDate(comment.comment.published)}
|
||||
community={community ? comment.community : undefined}
|
||||
title={comment.post.name}
|
||||
id={comment.post.id}
|
||||
titleClass="text-sm"
|
||||
/>
|
||||
</div>
|
||||
<Button
|
||||
color="secondary"
|
||||
href="/post/{comment.post.id}?thread={comment.comment.path}#{comment
|
||||
@@ -44,15 +49,9 @@
|
||||
class="self-start"
|
||||
title="Jump"
|
||||
>
|
||||
<Icon src={ArrowUturnUp} size="16" mini />
|
||||
<Icon src={ArrowUturnUp} size="16" micro />
|
||||
</Button>
|
||||
</div>
|
||||
<a
|
||||
href="/post/{getInstance()}/{comment.post.id}"
|
||||
class="font-medium text-base"
|
||||
>
|
||||
{comment.post.name}
|
||||
</a>
|
||||
<div class="list-none">
|
||||
<Comment
|
||||
postId={comment.post.id}
|
||||
|
||||
@@ -251,7 +251,7 @@
|
||||
hover:text-primary-900 hover:dark:text-primary-100 transition-colors
|
||||
{$userSettings.font == 'satoshi/nunito'
|
||||
? 'font-display font-semibold'
|
||||
: 'font-medium'}"
|
||||
: 'font-medium'} {$$props.titleClass ?? ''}"
|
||||
class:text-slate-600={$userSettings.markReadPosts && read}
|
||||
class:dark:text-zinc-400={$userSettings.markReadPosts && read}
|
||||
class:text-base={view == 'compact'}
|
||||
|
||||
@@ -1,3 +1,10 @@
|
||||
<span {...$$restProps} class="text-lg font-semibold {$$props.class}">
|
||||
<script lang="ts">
|
||||
export let small: boolean = false
|
||||
</script>
|
||||
|
||||
<span
|
||||
{...$$restProps}
|
||||
class="{!small ? 'text-lg' : 'text-xs'} font-semibold {$$props.class}"
|
||||
>
|
||||
<slot />
|
||||
</span>
|
||||
@@ -252,7 +252,9 @@
|
||||
},
|
||||
"reason": "Reason",
|
||||
"resolve": "Resolve",
|
||||
"unresolve": "Unresolve"
|
||||
"resolved": "Resolved",
|
||||
"unresolve": "Unresolve",
|
||||
"resolvedBy": "Resolved by"
|
||||
},
|
||||
"admin": {
|
||||
"title": "Administration",
|
||||
|
||||
@@ -33,6 +33,7 @@ interface BaseReport {
|
||||
timestamp: Date
|
||||
resolved: boolean
|
||||
id: number
|
||||
resolver?: Person
|
||||
}
|
||||
|
||||
export const generalizeCommentReport = (
|
||||
@@ -51,6 +52,7 @@ export const generalizeCommentReport = (
|
||||
timestamp: publishedToDate(report.comment_report.published),
|
||||
resolved: report.comment_report.resolved,
|
||||
id: report.comment_report.id,
|
||||
resolver: report.resolver,
|
||||
})
|
||||
|
||||
export const generalizePostReport = (report: PostReportView): ReportView => ({
|
||||
@@ -69,6 +71,7 @@ export const generalizePostReport = (report: PostReportView): ReportView => ({
|
||||
timestamp: publishedToDate(report.post_report.published),
|
||||
resolved: report.post_report.resolved,
|
||||
id: report.post_report.id,
|
||||
resolver: report.resolver,
|
||||
})
|
||||
|
||||
export const generalizePrivateMessageReport = (
|
||||
@@ -82,6 +85,7 @@ export const generalizePrivateMessageReport = (
|
||||
timestamp: publishedToDate(report.private_message_report.published),
|
||||
resolved: report.private_message_report.resolved,
|
||||
id: report.private_message_report.id,
|
||||
resolver: report.resolver,
|
||||
})
|
||||
|
||||
export type Report =
|
||||
|
||||
@@ -9,12 +9,14 @@
|
||||
PostReportView,
|
||||
PrivateMessageReportView,
|
||||
} from 'lemmy-js-client'
|
||||
import { Check, Icon } from 'svelte-hero-icons'
|
||||
import { Check, CheckCircle, Icon } from 'svelte-hero-icons'
|
||||
import { notifications, profile } from '$lib/auth.js'
|
||||
import { Button } from 'mono-svelte'
|
||||
import type { ReportView } from '$lib/lemmy/report.js'
|
||||
import PrivateMessage from '$lib/components/lemmy/inbox/PrivateMessage.svelte'
|
||||
import { t } from '$lib/translations'
|
||||
import SectionTitle from '$lib/components/ui/SectionTitle.svelte'
|
||||
import UserLink from '$lib/components/lemmy/user/UserLink.svelte'
|
||||
|
||||
export let item: ReportView
|
||||
|
||||
@@ -32,6 +34,7 @@
|
||||
})
|
||||
|
||||
item.resolved = res.comment_report_view.comment_report.resolved
|
||||
item.resolver = res.comment_report_view.resolver
|
||||
|
||||
toast({
|
||||
content: item.resolved
|
||||
@@ -49,6 +52,7 @@
|
||||
})
|
||||
|
||||
item.resolved = res.post_report_view.post_report.resolved
|
||||
item.resolver = res.post_report_view.resolver
|
||||
toast({
|
||||
content: item.resolved
|
||||
? $t('toast.resolveReport')
|
||||
@@ -66,6 +70,9 @@
|
||||
|
||||
item.resolved =
|
||||
res.private_message_report_view.private_message_report.resolved
|
||||
|
||||
item.resolver = res.private_message_report_view.resolver
|
||||
|
||||
toast({
|
||||
content: item.resolved
|
||||
? $t('toast.resolveReport')
|
||||
@@ -103,24 +110,34 @@
|
||||
/>
|
||||
{/if}
|
||||
|
||||
<div class="flex flex-row gap-4 items-center">
|
||||
<div class="flex flex-row gap-4 items-center flex-wrap">
|
||||
<div>
|
||||
<span class="text-xs font-bold dark:text-zinc-400 text-slate-600">
|
||||
<SectionTitle small>
|
||||
{$t('routes.moderation.reason')}
|
||||
</span>
|
||||
</SectionTitle>
|
||||
<p>
|
||||
{item.reason}
|
||||
</p>
|
||||
</div>
|
||||
{#if item.resolver}
|
||||
<div>
|
||||
<SectionTitle small>
|
||||
{$t('routes.moderation.resolvedBy')}
|
||||
</SectionTitle>
|
||||
<UserLink avatar user={item.resolver} />
|
||||
</div>
|
||||
{/if}
|
||||
<Button
|
||||
on:click={resolve}
|
||||
class="w-8 h-8 !p-1 ml-auto {item.resolved
|
||||
class="ml-auto {item.resolved
|
||||
? '!text-green-600 dark:!text-green-400'
|
||||
: ''}"
|
||||
title={$t('routes.moderation.resolve')}
|
||||
loading={resolving}
|
||||
disabled={resolving}
|
||||
>
|
||||
<Icon src={Check} mini size="16" slot="prefix" />
|
||||
<Icon src={CheckCircle} micro={item.resolved} size="18" slot="prefix" />
|
||||
{!item.resolved
|
||||
? $t('routes.moderation.resolve')
|
||||
: $t('routes.moderation.resolved')}
|
||||
</Button>
|
||||
</div>
|
||||
Reference in new issue
Block a user