feat: rewrite report/inbox handling

This commit is contained in:
Xyphyn committed 2023-09-17 14:40:55 -07:00
1 parent d9ab0db31c
commit 30d5dc9bf2
13 files changed
+468 -429

No files matched your search

+27 -16
View File
@@ -1,8 +1,10 @@
<script lang="ts">
import { profile } from '$lib/auth.js'
import ShieldIcon from '$lib/components/lemmy/moderation/ShieldIcon.svelte'
import Avatar from '$lib/components/ui/Avatar.svelte'
import { userSettings } from '$lib/settings.js'
import type { Person } from 'lemmy-js-client'
import { Badge } from 'mono-svelte'
import { Icon, NoSymbol } from 'svelte-hero-icons'
export let user: Person
@@ -11,6 +13,12 @@
export let badges: boolean = true
export let inComment: boolean = false
export let showInstance: boolean = false
export let shownBadges = {
admin: true,
you: false,
bot: true,
banned: true,
}
function linkFromCommunity(user: Person) {
const domain = new URL(user.actor_id).hostname
@@ -44,21 +52,24 @@
</span>
{/if}
</span>
{#if badges && (user.admin || user.banned || user.bot_account)}
<span>
{#if user.admin}
<div class="text-red-500" title="Admin">
<ShieldIcon width={12} filled />
</div>
{/if}
{#if user.banned}
<div class="text-red-500" title="Banned">
<Icon src={NoSymbol} mini size="12" />
</div>
{/if}
{#if user.bot_account}
<div class="text-blue-500 font-bold" title="Bot">BOT</div>
{/if}
</span>
{#if badges}
{#if shownBadges.you}
<Badge color="green-subtle" label="You" class="text-[10px] px-1 py-[1px]">
You
</Badge>
{/if}
{#if shownBadges.admin && user.admin}
<div class="text-red-500" title="Admin">
<ShieldIcon width={12} filled />
</div>
{/if}
{#if shownBadges.banned && user.banned}
<div class="text-red-500" title="Banned">
<Icon src={NoSymbol} mini size="12" />
</div>
{/if}
{#if shownBadges.bot && user.bot_account}
<div class="text-blue-500 font-bold" title="Bot">BOT</div>
{/if}
{/if}
</a>