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