diff options
author | Thibaut Girka <thib@sitedethib.com> | 2020-08-02 14:30:28 +0200 |
---|---|---|
committer | Thibaut Girka <thib@sitedethib.com> | 2020-08-02 14:30:28 +0200 |
commit | 23cd5f2c154e228b6b7257e4f079550ec532da1e (patch) | |
tree | 5b948f7386d40b4afc9cb90f8d8ad17da6117299 /app/javascript/mastodon/features/compose | |
parent | b12117c4a375b906673a5b67506475a8e78ad6ef (diff) | |
parent | 3ade83483054cdc2f8e7887ad236ede4341c0c09 (diff) |
Merge branch 'master' into glitch-soc/merge-upstream
Diffstat (limited to 'app/javascript/mastodon/features/compose')
-rw-r--r-- | app/javascript/mastodon/features/compose/containers/warning_container.js | 17 |
1 files changed, 16 insertions, 1 deletions
diff --git a/app/javascript/mastodon/features/compose/containers/warning_container.js b/app/javascript/mastodon/features/compose/containers/warning_container.js index 8200a319f..947d20c5a 100644 --- a/app/javascript/mastodon/features/compose/containers/warning_container.js +++ b/app/javascript/mastodon/features/compose/containers/warning_container.js @@ -5,7 +5,22 @@ import PropTypes from 'prop-types'; import { FormattedMessage } from 'react-intl'; import { me } from '../../../initial_state'; -const APPROX_HASHTAG_RE = /(?:^|[^\/\)\w])#(\w*[a-zA-Z·]\w*)/i; +const HASHTAG_SEPARATORS = "_\\u00b7\\u200c"; +const ALPHA = '\\p{L}\\p{M}'; +const WORD = '\\p{L}\\p{M}\\p{N}\\p{Pc}'; +const APPROX_HASHTAG_RE = new RegExp( + '(?:^|[^\\/\\)\\w])#((' + + '[' + WORD + '_]' + + '[' + WORD + HASHTAG_SEPARATORS + ']*' + + '[' + ALPHA + HASHTAG_SEPARATORS + ']' + + '[' + WORD + HASHTAG_SEPARATORS +']*' + + '[' + WORD + '_]' + + ')|(' + + '[' + WORD + '_]*' + + '[' + ALPHA + ']' + + '[' + WORD + '_]*' + + '))', 'iu' +); const mapStateToProps = state => ({ needsLockWarning: state.getIn(['compose', 'privacy']) === 'private' && !state.getIn(['accounts', me, 'locked']), |