adding: bot badge inside timeline statuses

environments/review-develop-3zknud/deployments/2390^2
Tassoman 2 years ago committed by Alex Gleason
parent 3c7aa81be1
commit 6696cde093

@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Added ### Added
- Admin: redirect the homepage to any URL. - Admin: redirect the homepage to any URL.
- Compatibility: added compatibility with Friendica. - Compatibility: added compatibility with Friendica.
- Posts: bot badge on statuses from bot accounts.
### Changed ### Changed

@ -1,4 +1,5 @@
import React from 'react'; import React from 'react';
import { defineMessages, useIntl } from 'react-intl';
import { Link, useHistory } from 'react-router-dom'; import { Link, useHistory } from 'react-router-dom';
import HoverRefWrapper from 'soapbox/components/hover-ref-wrapper'; import HoverRefWrapper from 'soapbox/components/hover-ref-wrapper';
@ -8,6 +9,7 @@ import { useAppSelector, useOnScreen } from 'soapbox/hooks';
import { getAcct } from 'soapbox/utils/accounts'; import { getAcct } from 'soapbox/utils/accounts';
import { displayFqn } from 'soapbox/utils/state'; import { displayFqn } from 'soapbox/utils/state';
import Badge from './badge';
import RelativeTimestamp from './relative-timestamp'; import RelativeTimestamp from './relative-timestamp';
import { Avatar, Emoji, HStack, Icon, IconButton, Stack, Text } from './ui'; import { Avatar, Emoji, HStack, Icon, IconButton, Stack, Text } from './ui';
@ -18,6 +20,10 @@ interface IInstanceFavicon {
disabled?: boolean, disabled?: boolean,
} }
const messages = defineMessages({
bot: { id: 'account.badges.bot', defaultMessage: 'Bot' },
});
const InstanceFavicon: React.FC<IInstanceFavicon> = ({ account, disabled }) => { const InstanceFavicon: React.FC<IInstanceFavicon> = ({ account, disabled }) => {
const history = useHistory(); const history = useHistory();
@ -151,6 +157,8 @@ const Account = ({
return null; return null;
}; };
const intl = useIntl();
React.useEffect(() => { React.useEffect(() => {
const style: React.CSSProperties = {}; const style: React.CSSProperties = {};
const actionWidth = actionRef.current?.clientWidth || 0; const actionWidth = actionRef.current?.clientWidth || 0;
@ -223,6 +231,8 @@ const Account = ({
/> />
{account.verified && <VerificationBadge />} {account.verified && <VerificationBadge />}
{account.bot && <Badge slug='bot' title={intl.formatMessage(messages.bot)} />}
</HStack> </HStack>
</LinkEl> </LinkEl>
</ProfilePopper> </ProfilePopper>

Loading…
Cancel
Save