diff --git a/app/soapbox/features/account/components/header.tsx b/app/soapbox/features/account/components/header.tsx index 84ec7c569..506e0e485 100644 --- a/app/soapbox/features/account/components/header.tsx +++ b/app/soapbox/features/account/components/header.tsx @@ -317,13 +317,7 @@ const Header: React.FC = ({ account }) => { icon: require('@tabler/icons/at.svg'), }); - if (account.getIn(['pleroma', 'accepts_chat_messages']) === true) { - menu.push({ - text: intl.formatMessage(messages.chat, { name: account.username }), - action: onChat, - icon: require('@tabler/icons/messages.svg'), - }); - } else if (features.privacyScopes) { + if (features.privacyScopes) { menu.push({ text: intl.formatMessage(messages.direct, { name: account.username }), action: onDirect, @@ -500,26 +494,41 @@ const Header: React.FC = ({ account }) => { }; const renderMessageButton = () => { - if (!ownAccount || !account || account.id === ownAccount?.id) { - return null; + if (features.chatsWithFollowers) { // Truth Social + if (!ownAccount || !account || account.id === ownAccount?.id) { + return null; + } + + const canChat = account.relationship?.followed_by; + if (!canChat) { + return null; + } + + return ( + createAndNavigateToChat.mutate(account.id)} + title={intl.formatMessage(messages.chat, { name: account.username })} + theme='outlined' + className='px-2' + iconClassName='w-4 h-4' + disabled={createAndNavigateToChat.isLoading} + /> + ); } - const canChat = account.relationship?.followed_by; - if (!canChat) { - return null; - } - - return ( + if (account.getIn(['pleroma', 'accepts_chat_messages']) === true) { createAndNavigateToChat.mutate(account.id)} + onClick={onChat} title={intl.formatMessage(messages.chat, { name: account.username })} theme='outlined' className='px-2' iconClassName='w-4 h-4' - disabled={createAndNavigateToChat.isLoading} - /> - ); + />; + } + + return null; }; const renderShareButton = () => { diff --git a/app/soapbox/utils/features.ts b/app/soapbox/utils/features.ts index 16e178cd6..73ce6e143 100644 --- a/app/soapbox/utils/features.ts +++ b/app/soapbox/utils/features.ts @@ -234,6 +234,11 @@ const getInstanceFeatures = (instance: Instance) => { */ chatsV2: v.software === PLEROMA && gte(v.version, '2.3.0'), + /** + * Ability to only chat with people that follow you. + */ + chatsWithFollowers: v.software === TRUTHSOCIAL, + /** * Mastodon's newer solution for direct messaging. * @see {@link https://docs.joinmastodon.org/methods/timelines/conversations/}