]> cat aescling's git repositories - mastodon.git/blob - app/javascript/mastodon/features/compose/containers/warning_container.js
Restore vanilla components
[mastodon.git] / app / javascript / mastodon / features / compose / containers / warning_container.js
1 import React from 'react';
2 import { connect } from 'react-redux';
3 import Warning from '../components/warning';
4 import PropTypes from 'prop-types';
5 import { FormattedMessage } from 'react-intl';
6 import { me } from '../../../initial_state';
7
8 const mapStateToProps = state => ({
9 needsLockWarning: state.getIn(['compose', 'privacy']) === 'private' && !state.getIn(['accounts', me, 'locked']),
10 });
11
12 const WarningWrapper = ({ needsLockWarning }) => {
13 if (needsLockWarning) {
14 return <Warning message={<FormattedMessage id='compose_form.lock_disclaimer' defaultMessage='Your account is not {locked}. Anyone can follow you to view your follower-only posts.' values={{ locked: <a href='/settings/profile'><FormattedMessage id='compose_form.lock_disclaimer.lock' defaultMessage='locked' /></a> }} />} />;
15 }
16
17 return null;
18 };
19
20 WarningWrapper.propTypes = {
21 needsLockWarning: PropTypes.bool,
22 };
23
24 export default connect(mapStateToProps)(WarningWrapper);
This page took 0.078157 seconds and 4 git commands to generate.