Chats: fix message from profile button
This commit is contained in:
parent
df3a64a4af
commit
8b013cbf1c
1 changed files with 16 additions and 22 deletions
|
@ -8,7 +8,6 @@ import { defineMessages, FormattedMessage, useIntl } from 'react-intl';
|
||||||
import { Link, useHistory } from 'react-router-dom';
|
import { Link, useHistory } from 'react-router-dom';
|
||||||
|
|
||||||
import { blockAccount, followAccount, pinAccount, removeFromFollowers, unblockAccount, unmuteAccount, unpinAccount } from 'soapbox/actions/accounts';
|
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 { mentionCompose, directCompose } from 'soapbox/actions/compose';
|
||||||
import { blockDomain, unblockDomain } from 'soapbox/actions/domain-blocks';
|
import { blockDomain, unblockDomain } from 'soapbox/actions/domain-blocks';
|
||||||
import { openModal } from 'soapbox/actions/modals';
|
import { openModal } from 'soapbox/actions/modals';
|
||||||
|
@ -204,10 +203,6 @@ const Header: React.FC<IHeader> = ({ account }) => {
|
||||||
}));
|
}));
|
||||||
};
|
};
|
||||||
|
|
||||||
const onChat = () => {
|
|
||||||
dispatch(launchChat(account.id, history));
|
|
||||||
};
|
|
||||||
|
|
||||||
const onModerate = () => {
|
const onModerate = () => {
|
||||||
dispatch(openModal('ACCOUNT_MODERATION', { accountId: account.id }));
|
dispatch(openModal('ACCOUNT_MODERATION', { accountId: account.id }));
|
||||||
};
|
};
|
||||||
|
@ -520,7 +515,7 @@ const Header: React.FC<IHeader> = ({ account }) => {
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<IconButton
|
<IconButton
|
||||||
src={require('@tabler/icons/mail.svg')}
|
src={require('@tabler/icons/messages.svg')}
|
||||||
onClick={() => createAndNavigateToChat.mutate(account.id)}
|
onClick={() => createAndNavigateToChat.mutate(account.id)}
|
||||||
title={intl.formatMessage(messages.chat, { name: account.username })}
|
title={intl.formatMessage(messages.chat, { name: account.username })}
|
||||||
theme='outlined'
|
theme='outlined'
|
||||||
|
@ -529,20 +524,20 @@ const Header: React.FC<IHeader> = ({ account }) => {
|
||||||
disabled={createAndNavigateToChat.isLoading}
|
disabled={createAndNavigateToChat.isLoading}
|
||||||
/>
|
/>
|
||||||
);
|
);
|
||||||
}
|
} else if (account.getIn(['pleroma', 'accepts_chat_messages']) === true) {
|
||||||
|
return (
|
||||||
if (account.getIn(['pleroma', 'accepts_chat_messages']) === true) {
|
|
||||||
<IconButton
|
<IconButton
|
||||||
src={require('@tabler/icons/mail.svg')}
|
src={require('@tabler/icons/messages.svg')}
|
||||||
onClick={onChat}
|
onClick={() => createAndNavigateToChat.mutate(account.id)}
|
||||||
title={intl.formatMessage(messages.chat, { name: account.username })}
|
title={intl.formatMessage(messages.chat, { name: account.username })}
|
||||||
theme='outlined'
|
theme='outlined'
|
||||||
className='px-2'
|
className='px-2'
|
||||||
iconClassName='w-4 h-4'
|
iconClassName='w-4 h-4'
|
||||||
/>;
|
/>
|
||||||
}
|
);
|
||||||
|
} else {
|
||||||
return null;
|
return null;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
const renderShareButton = () => {
|
const renderShareButton = () => {
|
||||||
|
@ -607,6 +602,8 @@ const Header: React.FC<IHeader> = ({ account }) => {
|
||||||
<div className='mt-6 flex justify-end w-full sm:pb-1'>
|
<div className='mt-6 flex justify-end w-full sm:pb-1'>
|
||||||
<HStack space={2} className='mt-10'>
|
<HStack space={2} className='mt-10'>
|
||||||
<SubscriptionButton account={account} />
|
<SubscriptionButton account={account} />
|
||||||
|
{renderMessageButton()}
|
||||||
|
{renderShareButton()}
|
||||||
|
|
||||||
{ownAccount && (
|
{ownAccount && (
|
||||||
<Menu>
|
<Menu>
|
||||||
|
@ -644,9 +641,6 @@ const Header: React.FC<IHeader> = ({ account }) => {
|
||||||
</Menu>
|
</Menu>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
{renderShareButton()}
|
|
||||||
{renderMessageButton()}
|
|
||||||
|
|
||||||
<ActionButton account={account} />
|
<ActionButton account={account} />
|
||||||
</HStack>
|
</HStack>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in a new issue