Hide bio & familiar followers from Followers/Following lists (#38622)
This commit is contained in:
parent
b6f09b9a2b
commit
4e60a6f163
@ -11,7 +11,6 @@ import { useRelationship } from 'mastodon/hooks/useRelationship';
|
|||||||
import type { Relationship } from 'mastodon/models/relationship';
|
import type { Relationship } from 'mastodon/models/relationship';
|
||||||
|
|
||||||
import { EmojiHTML } from '../emoji/html';
|
import { EmojiHTML } from '../emoji/html';
|
||||||
import { FamiliarFollowers } from '../familiar_followers';
|
|
||||||
import { FollowButton } from '../follow_button';
|
import { FollowButton } from '../follow_button';
|
||||||
import { FormattedDateWrapper } from '../formatted_date';
|
import { FormattedDateWrapper } from '../formatted_date';
|
||||||
import { NumberFields, NumberFieldsItem } from '../number_fields';
|
import { NumberFields, NumberFieldsItem } from '../number_fields';
|
||||||
@ -31,10 +30,11 @@ interface Props {
|
|||||||
accountId: string | undefined;
|
accountId: string | undefined;
|
||||||
stats?: Stat[];
|
stats?: Stat[];
|
||||||
renderButton?: (options: RenderButtonOptions) => React.ReactNode;
|
renderButton?: (options: RenderButtonOptions) => React.ReactNode;
|
||||||
|
withBio?: boolean;
|
||||||
withBorder?: boolean;
|
withBorder?: boolean;
|
||||||
}
|
}
|
||||||
|
|
||||||
const DEFAULT_STATS: Stat[] = ['followers', 'following', 'joined'];
|
const DEFAULT_STATS: Stat[] = ['followers', 'posts', 'last-active'];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Extended account list item with bio, verified link badge,
|
* Extended account list item with bio, verified link badge,
|
||||||
@ -46,6 +46,7 @@ const DEFAULT_STATS: Stat[] = ['followers', 'following', 'joined'];
|
|||||||
export const AccountListItem: React.FC<Props> = ({
|
export const AccountListItem: React.FC<Props> = ({
|
||||||
accountId,
|
accountId,
|
||||||
stats = DEFAULT_STATS,
|
stats = DEFAULT_STATS,
|
||||||
|
withBio = true,
|
||||||
withBorder = true,
|
withBorder = true,
|
||||||
renderButton = defaultRenderButton,
|
renderButton = defaultRenderButton,
|
||||||
}) => {
|
}) => {
|
||||||
@ -161,8 +162,7 @@ export const AccountListItem: React.FC<Props> = ({
|
|||||||
/>
|
/>
|
||||||
)}
|
)}
|
||||||
</NumberFields>
|
</NumberFields>
|
||||||
<FamiliarFollowers accountId={accountId} />
|
{withBio && account.note.length > 0 && (
|
||||||
{account.note.length > 0 && (
|
|
||||||
<EmojiHTML
|
<EmojiHTML
|
||||||
className={classNames(classes.bio, 'translate')}
|
className={classNames(classes.bio, 'translate')}
|
||||||
htmlString={account.note_emojified}
|
htmlString={account.note_emojified}
|
||||||
|
|||||||
@ -146,7 +146,6 @@ export const CollectionAccountsList: React.FC<{
|
|||||||
<AccountListItem
|
<AccountListItem
|
||||||
accountId={account_id}
|
accountId={account_id}
|
||||||
withBorder={index !== items.length - 1}
|
withBorder={index !== items.length - 1}
|
||||||
stats={['followers', 'last-active']}
|
|
||||||
renderButton={renderAccountItemButton}
|
renderButton={renderAccountItemButton}
|
||||||
/>
|
/>
|
||||||
</Article>
|
</Article>
|
||||||
|
|||||||
@ -53,12 +53,20 @@ export const AccountList: FC<AccountListProps> = ({
|
|||||||
}
|
}
|
||||||
const children =
|
const children =
|
||||||
list?.items.map((followerId) => (
|
list?.items.map((followerId) => (
|
||||||
<AccountListItem key={followerId} accountId={followerId} />
|
<AccountListItem
|
||||||
|
key={followerId}
|
||||||
|
accountId={followerId}
|
||||||
|
withBio={false}
|
||||||
|
/>
|
||||||
)) ?? [];
|
)) ?? [];
|
||||||
|
|
||||||
if (prependAccountId) {
|
if (prependAccountId) {
|
||||||
children.unshift(
|
children.unshift(
|
||||||
<AccountListItem key={prependAccountId} accountId={prependAccountId} />,
|
<AccountListItem
|
||||||
|
key={prependAccountId}
|
||||||
|
accountId={prependAccountId}
|
||||||
|
withBio={false}
|
||||||
|
/>,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
return children;
|
return children;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user