Files
5chan/src/hooks/use-board-pseudonymity-mode.ts
T
Tommaso CasaburiandGitHub d7703953fb refactor: migrate 5chan to the community hooks API (#1073)
* refactor(community-api): migrate 5chan to community hooks

* fix(review): address PR feedback

* fix(review): preserve legacy board context fallbacks

* fix(review): address latest bot feedback

* fix(review): use communityAddress in edit menu privileges
2026-03-13 13:25:10 +08:00

14 lines
657 B
TypeScript

import { useDirectoryByAddress } from './use-directories';
import { useCommunityField } from './use-stable-community';
/**
* Prefer authoritative live board metadata when available, but fall back to the
* bundled directory entry so known boards can render IDs immediately on first load.
*/
export const useBoardPseudonymityMode = (communityAddress: string | undefined): string | undefined => {
const directory = useDirectoryByAddress(communityAddress);
const livePseudonymityMode = useCommunityField(communityAddress, (community) => community?.features?.pseudonymityMode);
return livePseudonymityMode ?? directory?.features?.pseudonymityMode;
};