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