From 8b013cbf1cd26856147d49b00a3a286a739608b4 Mon Sep 17 00:00:00 2001 From: Alex Gleason Date: Wed, 7 Dec 2022 08:23:35 -0600 Subject: [PATCH] Chats: fix message from profile button --- .../features/account/components/header.tsx | 38 ++++++++----------- 1 file changed, 16 insertions(+), 22 deletions(-) diff --git a/app/soapbox/features/account/components/header.tsx b/app/soapbox/features/account/components/header.tsx index fae9baf69..47584dc68 100644 --- a/app/soapbox/features/account/components/header.tsx +++ b/app/soapbox/features/account/components/header.tsx @@ -8,7 +8,6 @@ import { defineMessages, FormattedMessage, useIntl } from 'react-intl'; import { Link, useHistory } from 'react-router-dom'; import { blockAccount, followAccount, pinAccount, removeFromFollowers, unblockAccount, unmuteAccount, unpinAccount } from 'soapbox/actions/accounts'; -import { launchChat } from 'soapbox/actions/chats'; import { mentionCompose, directCompose } from 'soapbox/actions/compose'; import { blockDomain, unblockDomain } from 'soapbox/actions/domain-blocks'; import { openModal } from 'soapbox/actions/modals'; @@ -204,10 +203,6 @@ const Header: React.FC = ({ account }) => { })); }; - const onChat = () => { - dispatch(launchChat(account.id, history)); - }; - const onModerate = () => { dispatch(openModal('ACCOUNT_MODERATION', { accountId: account.id })); }; @@ -520,7 +515,7 @@ const Header: React.FC = ({ account }) => { return ( createAndNavigateToChat.mutate(account.id)} title={intl.formatMessage(messages.chat, { name: account.username })} theme='outlined' @@ -529,20 +524,20 @@ const Header: React.FC = ({ account }) => { disabled={createAndNavigateToChat.isLoading} /> ); + } else if (account.getIn(['pleroma', 'accepts_chat_messages']) === true) { + return ( + createAndNavigateToChat.mutate(account.id)} + title={intl.formatMessage(messages.chat, { name: account.username })} + theme='outlined' + className='px-2' + iconClassName='w-4 h-4' + /> + ); + } else { + return null; } - - if (account.getIn(['pleroma', 'accepts_chat_messages']) === true) { - ; - } - - return null; }; const renderShareButton = () => { @@ -607,6 +602,8 @@ const Header: React.FC = ({ account }) => {
+ {renderMessageButton()} + {renderShareButton()} {ownAccount && ( @@ -644,9 +641,6 @@ const Header: React.FC = ({ account }) => { )} - {renderShareButton()} - {renderMessageButton()} -