fix(posts): render per-post IDs on initial board load

This commit is contained in:
plebeius
2026-03-07 12:46:37 +08:00
parent 109811d144
commit 08d929bb97
4 changed files with 45 additions and 7 deletions
+3 -3
View File
@@ -22,7 +22,7 @@ import useHide from '../../hooks/use-hide';
import useStateString from '../../hooks/use-state-string';
import useScrollToReply from '../../hooks/use-scroll-to-reply';
import { useCurrentTime } from '../../hooks/use-current-time';
import { useSubplebbitField } from '../../hooks/use-stable-subplebbit';
import { useBoardPseudonymityMode } from '../../hooks/use-board-pseudonymity-mode';
import CommentContent from '../comment-content';
import CommentMedia from '../comment-media';
import EditMenu from '../edit-menu/edit-menu';
@@ -214,11 +214,11 @@ const PostInfo = ({
const alertThresholdSeconds = getAlertThresholdSeconds();
const isOverThreshold = isAwaitingApproval && timeWaiting > alertThresholdSeconds;
const userID = address && getShortAddress(address); // shortened to 8 chars for display; users can verify the full user ID via "Copy user ID" in the post menu to guard against spoofing
const userID = address ? getShortAddress(address) : shortAddress;
const userIDBackgroundColor = hashStringToColor(userID);
const userIDTextColor = getTextColorForBackground(userIDBackgroundColor);
const pseudonymityMode = useSubplebbitField(subplebbitAddress, (sub) => sub?.features?.pseudonymityMode);
const pseudonymityMode = useBoardPseudonymityMode(subplebbitAddress);
const showUserID = pseudonymityMode === 'per-post';
const handleUserAddressClick = useAuthorAddressClick();
+3 -3
View File
@@ -21,7 +21,7 @@ import useHide from '../../hooks/use-hide';
import useStateString from '../../hooks/use-state-string';
import useScrollToReply from '../../hooks/use-scroll-to-reply';
import { useCurrentTime } from '../../hooks/use-current-time';
import { useSubplebbitField } from '../../hooks/use-stable-subplebbit';
import { useBoardPseudonymityMode } from '../../hooks/use-board-pseudonymity-mode';
import CommentContent from '../comment-content';
import CommentMedia from '../comment-media';
import LoadingEllipsis from '../loading-ellipsis';
@@ -192,7 +192,7 @@ const PostInfoAndMedia = ({ post, postReplyCount = 0, roles, threadNumber }: Pos
const canDeleteFailedPost = hasFailedState && typeof post?.index === 'number';
const postMenuProps = selectPostMenuProps(post);
const pseudonymityMode = useSubplebbitField(subplebbitAddress, (sub) => sub?.features?.pseudonymityMode);
const pseudonymityMode = useBoardPseudonymityMode(subplebbitAddress);
const showUserID = pseudonymityMode === 'per-post';
const handleUserAddressClick = useAuthorAddressClick();
@@ -205,7 +205,7 @@ const PostInfoAndMedia = ({ post, postReplyCount = 0, roles, threadNumber }: Pos
return Math.max(domCount, 1);
})();
const userID = address && getShortAddress(address); // shortened to 8 chars for display; users can verify the full user ID via "Copy user ID" in the post menu to guard against spoofing
const userID = address ? getShortAddress(address) : shortAddress;
const userIDBackgroundColor = hashStringToColor(userID);
const userIDTextColor = getTextColorForBackground(userIDBackgroundColor);