Chats: only show message button if the user supports chats
This commit is contained in:
parent
c0f6830e7f
commit
9493b261ef
3 changed files with 9 additions and 12 deletions
|
@ -5,6 +5,7 @@ import { connect } from 'react-redux';
|
|||
import ImmutablePropTypes from 'react-immutable-proptypes';
|
||||
import PropTypes from 'prop-types';
|
||||
import { defineMessages, injectIntl, FormattedMessage } from 'react-intl';
|
||||
import Icon from 'soapbox/components/icon';
|
||||
import Button from 'soapbox/components/button';
|
||||
import ImmutablePureComponent from 'react-immutable-pure-component';
|
||||
import { isStaff } from 'soapbox/utils/accounts';
|
||||
|
@ -293,13 +294,10 @@ class Header extends ImmutablePureComponent {
|
|||
me && !deactivated &&
|
||||
<div className='account__header__extra__buttons'>
|
||||
<ActionButton account={account} />
|
||||
{account.get('id') !== me &&
|
||||
<Button className='button-alternative-2' onClick={this.props.onMessage}>
|
||||
<FormattedMessage
|
||||
id='account.message' defaultMessage='Message' values={{
|
||||
name: account.get('acct'),
|
||||
}}
|
||||
/>
|
||||
{account.get('id') !== me && account.getIn(['pleroma', 'accepts_chat_messages'], false) === true &&
|
||||
<Button className='button-alternative-2' onClick={this.props.onChat}>
|
||||
<Icon id='comment' />
|
||||
<FormattedMessage id='account.message' defaultMessage='Message' />
|
||||
</Button>
|
||||
}
|
||||
<DropdownMenuContainer items={menu} icon='ellipsis-v' size={24} direction='right' />
|
||||
|
|
|
@ -72,11 +72,10 @@ export default class Header extends ImmutablePureComponent {
|
|||
this.props.onUnblockDomain(domain);
|
||||
}
|
||||
|
||||
handleMessage = () => {
|
||||
this.props.onMessage(this.props.account, this.context.router.history);
|
||||
handleChat = () => {
|
||||
this.props.onChat(this.props.account, this.context.router.history);
|
||||
}
|
||||
|
||||
|
||||
// handleEndorseToggle = () => {
|
||||
// this.props.onEndorseToggle(this.props.account);
|
||||
// }
|
||||
|
@ -100,7 +99,7 @@ export default class Header extends ImmutablePureComponent {
|
|||
onBlock={this.handleBlock}
|
||||
onMention={this.handleMention}
|
||||
onDirect={this.handleDirect}
|
||||
onMessage={this.handleMessage}
|
||||
onChat={this.handleChat}
|
||||
onReblogToggle={this.handleReblogToggle}
|
||||
onReport={this.handleReport}
|
||||
onMute={this.handleMute}
|
||||
|
|
|
@ -134,7 +134,7 @@ const mapDispatchToProps = (dispatch, { intl }) => ({
|
|||
}));
|
||||
},
|
||||
|
||||
onMessage(account, router) {
|
||||
onChat(account, router) {
|
||||
dispatch(startChat(account.get('id')));
|
||||
},
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue