Fix: Embed author handle using wrong DisplayName (#36413)
This commit is contained in:
@@ -1,23 +0,0 @@
|
|||||||
import PropTypes from 'prop-types';
|
|
||||||
|
|
||||||
import { Avatar } from 'mastodon/components/avatar';
|
|
||||||
import { useAppSelector } from 'mastodon/store';
|
|
||||||
import { LinkedDisplayName } from '@/mastodon/components/display_name';
|
|
||||||
|
|
||||||
export const AuthorLink = ({ accountId }) => {
|
|
||||||
const account = useAppSelector(state => state.getIn(['accounts', accountId]));
|
|
||||||
|
|
||||||
if (!account) {
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
return (
|
|
||||||
<LinkedDisplayName displayProps={{account}} className='story__details__shared__author-link'>
|
|
||||||
<Avatar account={account} size={16} />
|
|
||||||
</LinkedDisplayName>
|
|
||||||
);
|
|
||||||
};
|
|
||||||
|
|
||||||
AuthorLink.propTypes = {
|
|
||||||
accountId: PropTypes.string.isRequired,
|
|
||||||
};
|
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
import type { FC } from 'react';
|
||||||
|
|
||||||
|
import { LinkedDisplayName } from '@/mastodon/components/display_name';
|
||||||
|
import { Avatar } from 'mastodon/components/avatar';
|
||||||
|
import { useAppSelector } from 'mastodon/store';
|
||||||
|
|
||||||
|
export const AuthorLink: FC<{ accountId: string }> = ({ accountId }) => {
|
||||||
|
const account = useAppSelector((state) => state.accounts.get(accountId));
|
||||||
|
|
||||||
|
if (!account) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
return (
|
||||||
|
<LinkedDisplayName
|
||||||
|
displayProps={{ account, variant: 'simple' }}
|
||||||
|
className='story__details__shared__author-link'
|
||||||
|
>
|
||||||
|
<Avatar account={account} size={16} />
|
||||||
|
</LinkedDisplayName>
|
||||||
|
);
|
||||||
|
};
|
||||||
Reference in New Issue
Block a user