MarkdownButton: don't do the availability check in the component itself

purgecss
Alex Gleason 2022-03-04 13:01:22 -06:00
rodzic d98c54de4f
commit 664dfa2688
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 7211D1F99744FBB7
2 zmienionych plików z 1 dodań i 12 usunięć

Wyświetl plik

@ -17,7 +17,6 @@ class MarkdownButton extends React.PureComponent {
active: PropTypes.bool, active: PropTypes.bool,
onClick: PropTypes.func.isRequired, onClick: PropTypes.func.isRequired,
intl: PropTypes.object.isRequired, intl: PropTypes.object.isRequired,
unavailable: PropTypes.bool,
}; };
handleClick = () => { handleClick = () => {
@ -25,11 +24,7 @@ class MarkdownButton extends React.PureComponent {
} }
render() { render() {
const { intl, active, unavailable } = this.props; const { intl, active } = this.props;
if (unavailable) {
return null;
}
return ( return (
<div className='compose-form__markdown-button'> <div className='compose-form__markdown-button'>

Wyświetl plik

@ -1,17 +1,11 @@
import { connect } from 'react-redux'; import { connect } from 'react-redux';
import { getFeatures } from 'soapbox/utils/features';
import { changeComposeContentType } from '../../../actions/compose'; import { changeComposeContentType } from '../../../actions/compose';
import MarkdownButton from '../components/markdown_button'; import MarkdownButton from '../components/markdown_button';
const mapStateToProps = (state, { intl }) => { const mapStateToProps = (state, { intl }) => {
const instance = state.get('instance');
const features = getFeatures(instance);
return { return {
active: state.getIn(['compose', 'content_type']) === 'text/markdown', active: state.getIn(['compose', 'content_type']) === 'text/markdown',
unavailable: !features.richText,
}; };
}; };