Mastodon/app/javascript/flavours/glitch/hooks/useAccountVisibility.ts
Eugen Rochko 6373a84259 [Glitch] Add endorsed accounts to profiles in web UI
Port 79013c730d8c241d54823a1b5860f403de2b9a1c to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
2025-05-03 18:19:31 +02:00

23 lines
654 B
TypeScript

import { getAccountHidden } from 'flavours/glitch/selectors/accounts';
import { useAppSelector } from 'flavours/glitch/store';
export function useAccountVisibility(accountId?: string | null) {
const blockedBy = useAppSelector((state) =>
accountId
? !!state.relationships.getIn([accountId, 'blocked_by'], false)
: false,
);
const suspended = useAppSelector((state) =>
accountId ? !!state.accounts.getIn([accountId, 'suspended'], false) : false,
);
const hidden = useAppSelector((state) =>
accountId ? Boolean(getAccountHidden(state, accountId)) : false,
);
return {
blockedBy,
suspended,
hidden,
};
}