fix(ui): hide report badge for non-admin users (#147)

Co-authored-by: userAdityaa <aditya.chaudhary1558@gmail.com>
Co-committed-by: userAdityaa <aditya.chaudhary1558@gmail.com>
This commit is contained in:
2026-04-03 23:54:20 +00:00
committed by hodlbod
parent fe20fbfd28
commit fceccf47be
+4 -2
View File
@@ -23,7 +23,7 @@
import Icon from "@lib/components/Icon.svelte"
import Reaction from "@app/components/Reaction.svelte"
import ReportDetails from "@app/components/ReportDetails.svelte"
import {REACTION_KINDS} from "@app/core/state"
import {REACTION_KINDS, deriveUserIsSpaceAdmin} from "@app/core/state"
import {pushModal} from "@app/util/modal"
interface Props {
@@ -78,6 +78,8 @@
}
}
const userIsAdmin = deriveUserIsSpaceAdmin(url)
const onReportClick = () => pushModal(ReportDetails, {url, event})
const reportReasons = $derived(uniq(map(e => getTag("e", e.tags)?.[2], $reports.values())))
@@ -118,7 +120,7 @@
{#if $reactions.length > 0 || $zaps.length || $reports.length > 0 || children}
<div class="flex min-w-0 flex-wrap gap-2">
{#if url && $reports.length > 0}
{#if url && $reports.length > 0 && $userIsAdmin}
<button
type="button"
data-tip={`This content has been reported as "${displayList(reportReasons)}".`}