Consolidate 'message user' in profile

This commit is contained in:
Chewbacca 2022-11-07 11:43:17 -05:00
parent 14353c1aff
commit 57b2629337
2 changed files with 33 additions and 19 deletions

View file

@ -317,13 +317,7 @@ const Header: React.FC<IHeader> = ({ 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,6 +494,7 @@ const Header: React.FC<IHeader> = ({ account }) => {
};
const renderMessageButton = () => {
if (features.chatsWithFollowers) { // Truth Social
if (!ownAccount || !account || account.id === ownAccount?.id) {
return null;
}
@ -520,6 +515,20 @@ const Header: React.FC<IHeader> = ({ account }) => {
disabled={createAndNavigateToChat.isLoading}
/>
);
}
if (account.getIn(['pleroma', 'accepts_chat_messages']) === true) {
<IconButton
src={require('@tabler/icons/mail.svg')}
onClick={onChat}
title={intl.formatMessage(messages.chat, { name: account.username })}
theme='outlined'
className='px-2'
iconClassName='w-4 h-4'
/>;
}
return null;
};
const renderShareButton = () => {

View file

@ -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/}