fix: Hide limited user info in hover card (#35024)
This commit is contained in:
parent
319fbbbfac
commit
f92ff6d699
2 changed files with 95 additions and 58 deletions
|
@ -20,6 +20,7 @@ import { LoadingIndicator } from 'mastodon/components/loading_indicator';
|
||||||
import { ShortNumber } from 'mastodon/components/short_number';
|
import { ShortNumber } from 'mastodon/components/short_number';
|
||||||
import { useFetchFamiliarFollowers } from 'mastodon/features/account_timeline/hooks/familiar_followers';
|
import { useFetchFamiliarFollowers } from 'mastodon/features/account_timeline/hooks/familiar_followers';
|
||||||
import { domain } from 'mastodon/initial_state';
|
import { domain } from 'mastodon/initial_state';
|
||||||
|
import { getAccountHidden } from 'mastodon/selectors/accounts';
|
||||||
import { useAppSelector, useAppDispatch } from 'mastodon/store';
|
import { useAppSelector, useAppDispatch } from 'mastodon/store';
|
||||||
|
|
||||||
export const HoverCardAccount = forwardRef<
|
export const HoverCardAccount = forwardRef<
|
||||||
|
@ -31,6 +32,11 @@ export const HoverCardAccount = forwardRef<
|
||||||
const account = useAppSelector((state) =>
|
const account = useAppSelector((state) =>
|
||||||
accountId ? state.accounts.get(accountId) : undefined,
|
accountId ? state.accounts.get(accountId) : undefined,
|
||||||
);
|
);
|
||||||
|
const suspended = account?.suspended;
|
||||||
|
const hidden = useAppSelector((state) =>
|
||||||
|
accountId ? getAccountHidden(state, accountId) : undefined,
|
||||||
|
);
|
||||||
|
const isSuspendedOrHidden = Boolean(suspended || hidden);
|
||||||
|
|
||||||
const note = useAppSelector(
|
const note = useAppSelector(
|
||||||
(state) =>
|
(state) =>
|
||||||
|
@ -70,10 +76,30 @@ export const HoverCardAccount = forwardRef<
|
||||||
{account ? (
|
{account ? (
|
||||||
<>
|
<>
|
||||||
<Link to={`/@${account.acct}`} className='hover-card__name'>
|
<Link to={`/@${account.acct}`} className='hover-card__name'>
|
||||||
<Avatar account={account} size={46} />
|
<Avatar
|
||||||
|
account={isSuspendedOrHidden ? undefined : account}
|
||||||
|
size={46}
|
||||||
|
/>
|
||||||
<DisplayName account={account} localDomain={domain} />
|
<DisplayName account={account} localDomain={domain} />
|
||||||
</Link>
|
</Link>
|
||||||
|
|
||||||
|
{isSuspendedOrHidden ? (
|
||||||
|
<div className='hover-card__limited-account-note'>
|
||||||
|
{suspended ? (
|
||||||
|
<FormattedMessage
|
||||||
|
id='empty_column.account_suspended'
|
||||||
|
defaultMessage='Account suspended'
|
||||||
|
/>
|
||||||
|
) : (
|
||||||
|
<FormattedMessage
|
||||||
|
id='limited_account_hint.title'
|
||||||
|
defaultMessage='This profile has been hidden by the moderators of {domain}.'
|
||||||
|
values={{ domain }}
|
||||||
|
/>
|
||||||
|
)}
|
||||||
|
</div>
|
||||||
|
) : (
|
||||||
|
<>
|
||||||
<div className='hover-card__text-row'>
|
<div className='hover-card__text-row'>
|
||||||
<AccountBio
|
<AccountBio
|
||||||
note={account.note_emojified}
|
note={account.note_emojified}
|
||||||
|
@ -108,7 +134,11 @@ export const HoverCardAccount = forwardRef<
|
||||||
/>
|
/>
|
||||||
<AvatarGroup compact>
|
<AvatarGroup compact>
|
||||||
{familiarFollowers.slice(0, 3).map((account) => (
|
{familiarFollowers.slice(0, 3).map((account) => (
|
||||||
<Avatar key={account.id} account={account} size={22} />
|
<Avatar
|
||||||
|
key={account.id}
|
||||||
|
account={account}
|
||||||
|
size={22}
|
||||||
|
/>
|
||||||
))}
|
))}
|
||||||
</AvatarGroup>
|
</AvatarGroup>
|
||||||
</div>
|
</div>
|
||||||
|
@ -134,6 +164,8 @@ export const HoverCardAccount = forwardRef<
|
||||||
|
|
||||||
<FollowButton accountId={accountId} />
|
<FollowButton accountId={accountId} />
|
||||||
</>
|
</>
|
||||||
|
)}
|
||||||
|
</>
|
||||||
) : (
|
) : (
|
||||||
<LoadingIndicator />
|
<LoadingIndicator />
|
||||||
)}
|
)}
|
||||||
|
|
|
@ -10899,6 +10899,11 @@ noscript {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&__limited-account-note {
|
||||||
|
text-align: center;
|
||||||
|
font-weight: 500;
|
||||||
|
}
|
||||||
|
|
||||||
.display-name {
|
.display-name {
|
||||||
font-size: 15px;
|
font-size: 15px;
|
||||||
line-height: 22px;
|
line-height: 22px;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue