refactor: remove broken anon mode feature

- delete the anon mode hook/store and stop wiring publish flows through alternate signers
  - strip the settings UI, avatar warning, reply indicators, and FAQ text that referenced the toggle
  - drop the anon mode translation keys via scripts/update-translations.js
This commit is contained in:
plebeius
2025-11-25 13:13:38 +01:00
parent f6cf6ec4eb
commit f037a669c0
51 changed files with 26 additions and 521 deletions
+2 -14
View File
@@ -1,8 +1,6 @@
import { useMemo } from 'react';
import { useAccount } from '@plebbit/plebbit-react-hooks';
import useSubplebbitsStore from '@plebbit/plebbit-react-hooks/dist/stores/subplebbits';
import useAnonModeStore from '../stores/use-anon-mode-store';
import useAnonMode from './use-anon-mode';
interface AuthorPrivilegesProps {
commentAuthorAddress: string;
@@ -15,26 +13,16 @@ const useAuthorPrivileges = ({ commentAuthorAddress, subplebbitAddress, postCid
const accountAuthorAddress = account?.author?.address;
const subplebbit = useSubplebbitsStore((state) => state.subplebbits[subplebbitAddress]);
const { roles } = subplebbit || {};
const { getAddressSigner, getThreadSigner } = useAnonModeStore();
const { anonMode } = useAnonMode(postCid);
const { isCommentAuthorMod, isAccountMod, isAccountCommentAuthor, commentAuthorRole, accountAuthorRole } = useMemo(() => {
const commentAuthorRole = roles?.[commentAuthorAddress]?.role;
const isCommentAuthorMod = commentAuthorRole === 'admin' || commentAuthorRole === 'owner' || commentAuthorRole === 'moderator';
const accountAuthorRole = roles?.[accountAuthorAddress]?.role;
const isAccountMod = accountAuthorRole === 'admin' || accountAuthorRole === 'owner' || accountAuthorRole === 'moderator';
let isAccountCommentAuthor = postCid && accountAuthorAddress === commentAuthorAddress;
if (!isAccountCommentAuthor && anonMode) {
const addressSigner = getAddressSigner(commentAuthorAddress);
const threadSigner = postCid ? getThreadSigner(postCid) : null;
isAccountCommentAuthor = (addressSigner && addressSigner.address === commentAuthorAddress) || (threadSigner && threadSigner.address === commentAuthorAddress);
}
const isAccountCommentAuthor = !!postCid && accountAuthorAddress === commentAuthorAddress;
return { isCommentAuthorMod, isAccountMod, isAccountCommentAuthor, commentAuthorRole, accountAuthorRole };
}, [roles, commentAuthorAddress, accountAuthorAddress, anonMode, getAddressSigner, getThreadSigner, postCid]);
}, [roles, commentAuthorAddress, accountAuthorAddress, postCid]);
return { isCommentAuthorMod, isAccountMod, isAccountCommentAuthor, commentAuthorRole, accountAuthorRole };
};