diff options
author | David Yip <yipdw@member.fsf.org> | 2018-01-20 16:37:52 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-01-20 16:37:52 -0600 |
commit | e7a0840f8cfcc199665db43e28af74ec56ffe734 (patch) | |
tree | 1d73ff938eb5b184eee16e01768cd901d57ebe3f /app/javascript/flavours/glitch/features/composer/index.js | |
parent | 24b6e4121f656d24adc5676e8a207ded610a7ea7 (diff) | |
parent | 1287b2782b8e8a1d2c7a3684ebf1327fc5647f51 (diff) |
Merge pull request #336 from ThibG/glitch-soc/features/tag-warning
Display a warning when composing unlisted toots with something looking like a hashtag
Diffstat (limited to 'app/javascript/flavours/glitch/features/composer/index.js')
-rw-r--r-- | app/javascript/flavours/glitch/features/composer/index.js | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/app/javascript/flavours/glitch/features/composer/index.js b/app/javascript/flavours/glitch/features/composer/index.js index 29a2f4775..e50f3ec3f 100644 --- a/app/javascript/flavours/glitch/features/composer/index.js +++ b/app/javascript/flavours/glitch/features/composer/index.js @@ -3,6 +3,8 @@ import PropTypes from 'prop-types'; import React from 'react'; import ImmutablePropTypes from 'react-immutable-proptypes'; +const APPROX_HASHTAG_RE = /(?:^|[^\/\)\w])#(\S+)/i; + // Actions. import { cancelReplyCompose, @@ -36,6 +38,7 @@ import ComposerSpoiler from './spoiler'; import ComposerTextarea from './textarea'; import ComposerUploadForm from './upload_form'; import ComposerWarning from './warning'; +import ComposerHashtagWarning from './hashtag_warning'; // Utils. import { countableText } from 'flavours/glitch/util/counter'; @@ -312,6 +315,7 @@ class Composer extends React.Component { text={spoilerText} /> {privacy === 'private' && amUnlocked ? <ComposerWarning /> : null} + {privacy !== 'public' && APPROX_HASHTAG_RE.test(text) ? <ComposerHashtagWarning /> : null} {replyContent ? ( <ComposerReply account={replyAccount} |