fix(codebase audit): preserve cleanup without regressions

Fix codebase audit regressions while preserving UI/UX behavior and adding review-driven hardening.
This commit is contained in:
Tommaso Casaburi
2026-04-24 15:48:07 +07:00
committed by GitHub
parent 5df994b2c7
commit 5dc5408a15
70 changed files with 1478 additions and 518 deletions
+18 -5
View File
@@ -1,4 +1,4 @@
import { ChallengeVerification } from '@bitsocial/bitsocial-react-hooks';
import type { ChallengeVerification, Comment } from '@bitsocial/bitsocial-react-hooks';
import { getFallbackDirectoriesData } from '../../hooks/use-directories';
import { getCommentCommunityAddress } from './comment-utils';
import { getBoardPath } from './route-utils';
@@ -12,7 +12,20 @@ const resolveBoardIdentifier = (communityAddress: unknown): string => {
return boardPath === communityAddress ? communityAddress : `/${boardPath}/`;
};
export const alertChallengeVerificationFailed = (challengeVerification: ChallengeVerification, publication: any) => {
export type ChallengePublication = Partial<Comment> & {
author?: unknown;
commentCid?: string;
communityAddress?: string;
content?: string;
link?: string;
parentCid?: string;
shortCommunityAddress?: string;
subplebbitAddress?: string;
title?: string;
vote?: number;
};
export const alertChallengeVerificationFailed = (challengeVerification: ChallengeVerification, publication: ChallengePublication | undefined) => {
if (challengeVerification?.challengeSuccess === false) {
console.warn('Challenge Verification Failed:', challengeVerification, 'Publication:', publication);
@@ -44,7 +57,7 @@ export const alertChallengeVerificationFailed = (challengeVerification: Challeng
}
};
export const getPublicationType = (publication: any) => {
export const getPublicationType = (publication: ChallengePublication | undefined) => {
if (!publication) {
return;
}
@@ -60,7 +73,7 @@ export const getPublicationType = (publication: any) => {
return 'post';
};
export const getVotePreview = (publication: any) => {
export const getVotePreview = (publication: ChallengePublication | undefined) => {
if (typeof publication?.vote !== 'number') {
return '';
}
@@ -73,7 +86,7 @@ export const getVotePreview = (publication: any) => {
return votePreview;
};
export const getPublicationPreview = (publication: any) => {
export const getPublicationPreview = (publication: ChallengePublication | undefined) => {
if (!publication) {
return '';
}