fix: update Plebbit.getShortAddress calls to use object parameter

This commit is contained in:
plebeius
2025-12-24 13:29:09 +01:00
parent 0f7b50b573
commit 4cb3bda38c
9 changed files with 9 additions and 9 deletions
+1 -1
View File
@@ -71,7 +71,7 @@ const BoardHeader = () => {
? shortAddress.endsWith('.eth') || shortAddress.endsWith('.sol') ? shortAddress.endsWith('.eth') || shortAddress.endsWith('.sol')
? shortAddress.slice(0, -4) ? shortAddress.slice(0, -4)
: shortAddress : shortAddress
: subplebbitAddress && Plebbit.getShortAddress(subplebbitAddress))} : subplebbitAddress && Plebbit.getShortAddress({ address: subplebbitAddress }))}
{(isOffline || isOnlineStatusLoading) && !isInAllView && !isInSubscriptionsView && !isInModView && ( {(isOffline || isOnlineStatusLoading) && !isInAllView && !isInSubscriptionsView && !isInModView && (
<span className={styles.offlineIconWrapper}> <span className={styles.offlineIconWrapper}>
<Tooltip content={offlineTitle}> <Tooltip content={offlineTitle}>
+1 -1
View File
@@ -288,7 +288,7 @@ const CatalogPost = ({ post }: { post: Comment }) => {
{author?.displayName || _.capitalize(t('anonymous'))} {author?.displayName || _.capitalize(t('anonymous'))}
{isCatalogPostAuthorMod && <span className='capitalize'>{` ## Board ${catalogPostAuthorRole}`}</span>} {isCatalogPostAuthorMod && <span className='capitalize'>{` ## Board ${catalogPostAuthorRole}`}</span>}
</span> </span>
{(isInAllView || isInSubscriptionsView) && subplebbitAddress && ` to p/${Plebbit.getShortAddress(subplebbitAddress)}`} {(isInAllView || isInSubscriptionsView) && subplebbitAddress && ` to p/${Plebbit.getShortAddress({ address: subplebbitAddress })}`}
<span className={styles.postAgo}> {getFormattedTimeAgo(timestamp)}</span> <span className={styles.postAgo}> {getFormattedTimeAgo(timestamp)}</span>
{replyCount > 0 && ( {replyCount > 0 && (
<div className={styles.postLast}> <div className={styles.postLast}>
@@ -116,7 +116,7 @@ const CommentContent = ({ comment: post }: { comment: Comment }) => {
<Tooltip <Tooltip
children={`(${t('user_banned')})`} children={`(${t('user_banned')})`}
content={`${t('ban_expires_at', { content={`${t('ban_expires_at', {
address: subplebbitAddress && Plebbit.getShortAddress(subplebbitAddress), address: subplebbitAddress && Plebbit.getShortAddress({ address: subplebbitAddress }),
timestamp: getFormattedDate(commentAuthor?.banExpiresAt), timestamp: getFormattedDate(commentAuthor?.banExpiresAt),
interpolation: { escapeValue: false }, interpolation: { escapeValue: false },
})}${reason ? `. ${_.capitalize(t('reason'))}: "${reason}"` : ''}`} })}${reason ? `. ${_.capitalize(t('reason'))}: "${reason}"` : ''}`}
+1 -1
View File
@@ -71,7 +71,7 @@ const PostInfo = ({ post, postReplyCount = 0, roles, isHidden }: PostProps) => {
const location = useLocation(); const location = useLocation();
const isInPostPageView = isPostPageView(location.pathname, params); const isInPostPageView = isPostPageView(location.pathname, params);
const userID = address && Plebbit.getShortAddress(address); const userID = address && Plebbit.getShortAddress({ address });
const userIDBackgroundColor = hashStringToColor(userID); const userIDBackgroundColor = hashStringToColor(userID);
const userIDTextColor = getTextColorForBackground(userIDBackgroundColor); const userIDTextColor = getTextColorForBackground(userIDBackgroundColor);
+1 -1
View File
@@ -335,7 +335,7 @@ const PostFormTable = ({ closeForm, postCid }: { closeForm: () => void; postCid:
{isInModView && {isInModView &&
accountSubplebbitAddresses.map((address: string) => ( accountSubplebbitAddresses.map((address: string) => (
<option key={address} value={address}> <option key={address} value={address}>
{address && Plebbit.getShortAddress(address)} {address && Plebbit.getShortAddress({ address })}
</option> </option>
))} ))}
{isInSubscriptionsView && {isInSubscriptionsView &&
+1 -1
View File
@@ -75,7 +75,7 @@ const PostInfoAndMedia = ({ post, postReplyCount = 0, roles }: PostProps) => {
const handleUserAddressClick = useAuthorAddressClick(); const handleUserAddressClick = useAuthorAddressClick();
const numberOfPostsByAuthor = document.querySelectorAll(`[data-author-address="${shortAddress}"][data-post-cid="${postCid}"]`).length; const numberOfPostsByAuthor = document.querySelectorAll(`[data-author-address="${shortAddress}"][data-post-cid="${postCid}"]`).length;
const userID = address && Plebbit.getShortAddress(address); const userID = address && Plebbit.getShortAddress({ address });
const userIDBackgroundColor = hashStringToColor(userID); const userIDBackgroundColor = hashStringToColor(userID);
const userIDTextColor = getTextColorForBackground(userIDBackgroundColor); const userIDTextColor = getTextColorForBackground(userIDBackgroundColor);
@@ -44,7 +44,7 @@ const BlockedAddressesSetting = () => {
<ul className={styles.blockedAddresses}> <ul className={styles.blockedAddresses}>
{addressList.map((address: string) => ( {addressList.map((address: string) => (
<li key={address} className={styles.blockedAddress}> <li key={address} className={styles.blockedAddress}>
{address && Plebbit.getShortAddress(address)} <UnblockButton address={address} /> {address && Plebbit.getShortAddress({ address })} <UnblockButton address={address} />
</li> </li>
))} ))}
</ul> </ul>
@@ -57,7 +57,7 @@ const SubscriptionsSetting = () => {
<ul className={styles.subscriptions}> <ul className={styles.subscriptions}>
{subscriptions?.map((address: string) => ( {subscriptions?.map((address: string) => (
<li key={address} className={styles.subscription}> <li key={address} className={styles.subscription}>
{address && Plebbit.getShortAddress(address)} <SubscriptionButton address={address} /> {address && Plebbit.getShortAddress({ address })} <SubscriptionButton address={address} />
</li> </li>
))} ))}
</ul> </ul>
+1 -1
View File
@@ -166,7 +166,7 @@ const TopBarDesktop = () => {
// Render a subscription link // Render a subscription link
const renderSubscription = (address: string, index: number, total: number) => { const renderSubscription = (address: string, index: number, total: number) => {
const boardPath = getBoardPath(address, defaultSubplebbits); const boardPath = getBoardPath(address, defaultSubplebbits);
const displayText = address.endsWith('.eth') || address.endsWith('.sol') ? address : Plebbit.getShortAddress(address); const displayText = address.endsWith('.eth') || address.endsWith('.sol') ? address : Plebbit.getShortAddress({ address });
return ( return (
<span key={address}> <span key={address}>