Something went wrong. Try again.
Monorepo for Tangled
Something went wrong. Try again.
599 B · 22 lines
TypeScript
1234567891011121314151617181920212223import { page } from "$app/state";import { getAuth } from "$lib/auth.svelte";
export interface Reporting { readonly labelerDid: string; canReport(authorDid: string): boolean;}
export const createReporting = (labelerDid?: () => string | undefined): Reporting => { const auth = getAuth(); const labeler = $derived( labelerDid?.() ?? (page.data.publicConfig?.moderationServiceDid as string | undefined) ?? "" );
return { get labelerDid() { return labeler; }, canReport: (authorDid: string) => Boolean(labeler) && Boolean(auth?.currentDid) && !auth.hasAccount(authorDid) };};