From f72af5794da52d22fbb2a77e0fcbc111633fcab2 Mon Sep 17 00:00:00 2001 From: Thibaut Girka Date: Sat, 20 Apr 2019 22:05:09 +0200 Subject: Refactor Compose*Warning → ContainerWarning MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Regression: only one warning at a time --- .../features/compose/components/compose_form.js | 13 +++---- .../glitch/features/compose/components/warning.js | 26 +++++++++++++ .../compose/containers/warning_container.js | 44 ++++++++++++++++++++++ 3 files changed, 75 insertions(+), 8 deletions(-) create mode 100644 app/javascript/flavours/glitch/features/compose/components/warning.js create mode 100644 app/javascript/flavours/glitch/features/compose/containers/warning_container.js (limited to 'app/javascript/flavours/glitch/features/compose') 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 0f9b11fa3..1f37a1da5 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 && ( )} +