diff --git a/app/javascript/flavours/glitch/features/compose/components/compose_form.js b/app/javascript/flavours/glitch/features/compose/components/compose_form.js
index 0f9b11fa3b..1f37a1da59 100644
--- a/app/javascript/flavours/glitch/features/compose/components/compose_form.js
+++ b/app/javascript/flavours/glitch/features/compose/components/compose_form.js
@@ -4,8 +4,6 @@ import ImmutablePropTypes from 'react-immutable-proptypes';
import { defineMessages, injectIntl } from 'react-intl';
import ImmutablePureComponent from 'react-immutable-pure-component';
-const APPROX_HASHTAG_RE = /(?:^|[^\/\)\w])#(\S+)/i;
-
// Components.
import ComposerOptions from '../../composer/options';
import ComposerPublisher from '../../composer/publisher';
@@ -14,9 +12,7 @@ import ComposerSpoiler from '../../composer/spoiler';
import ComposerTextarea from '../../composer/textarea';
import ComposerUploadForm from '../../composer/upload_form';
import ComposerPollForm from '../../composer/poll_form';
-import ComposerWarning from '../../composer/warning';
-import ComposerHashtagWarning from '../../composer/hashtag_warning';
-import ComposerDirectWarning from '../../composer/direct_warning';
+import WarningContainer from '../containers/warning_container';
// Utils.
import { countableText } from 'flavours/glitch/util/counter';
@@ -321,9 +317,8 @@ class ComposeForm extends ImmutablePureComponent {
return (
- {privacy === 'direct' ?
: null}
- {privacy === 'private' && amUnlocked ?
: null}
- {privacy !== 'public' && APPROX_HASHTAG_RE.test(text) ?
: null}
+
+
{inReplyTo && (
)}
+
+
+ {({ opacity, scaleX, scaleY }) => (
+
+ {message}
+
+ )}
+
+ );
+ }
+
+}
diff --git a/app/javascript/flavours/glitch/features/compose/containers/warning_container.js b/app/javascript/flavours/glitch/features/compose/containers/warning_container.js
new file mode 100644
index 0000000000..fdd21f1148
--- /dev/null
+++ b/app/javascript/flavours/glitch/features/compose/containers/warning_container.js
@@ -0,0 +1,44 @@
+import React from 'react';
+import { connect } from 'react-redux';
+import Warning from '../components/warning';
+import PropTypes from 'prop-types';
+import { FormattedMessage } from 'react-intl';
+import { me } from 'flavours/glitch/util/initial_state';
+
+const APPROX_HASHTAG_RE = /(?:^|[^\/\)\w])#(\w*[a-zA-Z·]\w*)/i;
+
+const mapStateToProps = state => ({
+ needsLockWarning: state.getIn(['compose', 'privacy']) === 'private' && !state.getIn(['accounts', me, 'locked']),
+ hashtagWarning: state.getIn(['compose', 'privacy']) !== 'public' && APPROX_HASHTAG_RE.test(state.getIn(['compose', 'text'])),
+ directMessageWarning: state.getIn(['compose', 'privacy']) === 'direct',
+});
+
+const WarningWrapper = ({ needsLockWarning, hashtagWarning, directMessageWarning }) => {
+ if (needsLockWarning) {
+ return }} />} />;
+ }
+
+ if (hashtagWarning) {
+ return } />;
+ }
+
+ if (directMessageWarning) {
+ const message = (
+
+
+
+ );
+
+ return ;
+ }
+
+ return null;
+};
+
+WarningWrapper.propTypes = {
+ needsLockWarning: PropTypes.bool,
+ hashtagWarning: PropTypes.bool,
+ directMessageWarning: PropTypes.bool,
+};
+
+export default connect(mapStateToProps)(WarningWrapper);
diff --git a/app/javascript/flavours/glitch/features/composer/direct_warning/index.js b/app/javascript/flavours/glitch/features/composer/direct_warning/index.js
deleted file mode 100644
index 3b1369acd6..0000000000
--- a/app/javascript/flavours/glitch/features/composer/direct_warning/index.js
+++ /dev/null
@@ -1,55 +0,0 @@
-import React from 'react';
-import Motion from 'flavours/glitch/util/optional_motion';
-import spring from 'react-motion/lib/spring';
-import { defineMessages, FormattedMessage } from 'react-intl';
-import { termsLink} from 'flavours/glitch/util/backend_links';
-
-// This is the spring used with our motion.
-const motionSpring = spring(1, { damping: 35, stiffness: 400 });
-
-// Messages.
-const messages = defineMessages({
- disclaimer: {
- defaultMessage: 'This toot will only be sent to all the mentioned users.',
- id: 'compose_form.direct_message_warning',
- },
- learn_more: {
- defaultMessage: 'Learn more',
- id: 'compose_form.direct_message_warning_learn_more'
- }
-});
-
-// The component.
-export default function ComposerDirectWarning () {
- return (
-
- {({ opacity, scaleX, scaleY }) => (
-
-
-
- { termsLink !== undefined && }
-
-
- )}
-
- );
-}
-
-ComposerDirectWarning.propTypes = {};
diff --git a/app/javascript/flavours/glitch/features/composer/hashtag_warning/index.js b/app/javascript/flavours/glitch/features/composer/hashtag_warning/index.js
deleted file mode 100644
index 716028e4c6..0000000000
--- a/app/javascript/flavours/glitch/features/composer/hashtag_warning/index.js
+++ /dev/null
@@ -1,49 +0,0 @@
-import React from 'react';
-import Motion from 'flavours/glitch/util/optional_motion';
-import spring from 'react-motion/lib/spring';
-import { defineMessages, FormattedMessage } from 'react-intl';
-
-// This is the spring used with our motion.
-const motionSpring = spring(1, { damping: 35, stiffness: 400 });
-
-// Messages.
-const messages = defineMessages({
- disclaimer: {
- defaultMessage: 'This toot won\'t be listed under any hashtag as it is unlisted. Only public toots can be searched by hashtag.',
- id: 'compose_form.hashtag_warning',
- },
-});
-
-// The component.
-export default function ComposerHashtagWarning () {
- return (
-
- {({ opacity, scaleX, scaleY }) => (
-
-
-
- )}
-
- );
-}
-
-ComposerHashtagWarning.propTypes = {};
diff --git a/app/javascript/flavours/glitch/features/composer/warning/index.js b/app/javascript/flavours/glitch/features/composer/warning/index.js
deleted file mode 100644
index 8be8acbceb..0000000000
--- a/app/javascript/flavours/glitch/features/composer/warning/index.js
+++ /dev/null
@@ -1,59 +0,0 @@
-import React from 'react';
-import Motion from 'flavours/glitch/util/optional_motion';
-import spring from 'react-motion/lib/spring';
-import { defineMessages, FormattedMessage } from 'react-intl';
-import { profileLink } from 'flavours/glitch/util/backend_links';
-
-// This is the spring used with our motion.
-const motionSpring = spring(1, { damping: 35, stiffness: 400 });
-
-// Messages.
-const messages = defineMessages({
- disclaimer: {
- defaultMessage: 'Your account is not {locked}. Anyone can follow you to view your follower-only posts.',
- id: 'compose_form.lock_disclaimer',
- },
- locked: {
- defaultMessage: 'locked',
- id: 'compose_form.lock_disclaimer.lock',
- },
-});
-
-// The component.
-export default function ComposerWarning () {
- let lockedLink = ;
- if (profileLink !== undefined) {
- lockedLink = {lockedLink};
- }
- return (
-
- {({ opacity, scaleX, scaleY }) => (
-
-
-
- )}
-
- );
-}
-
-ComposerWarning.propTypes = {};