about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/features/compose/containers/warning_container.js
diff options
context:
space:
mode:
authorThibG <thib@sitedethib.com>2020-08-02 16:05:01 +0200
committerGitHub <noreply@github.com>2020-08-02 16:05:01 +0200
commit141ac8db8b98230188b13f1da801611bcdc6a9f1 (patch)
treefbfbc1daae45e7b4cdf8c0525b646a39ba29af96 /app/javascript/flavours/glitch/features/compose/containers/warning_container.js
parentb12117c4a375b906673a5b67506475a8e78ad6ef (diff)
parentde7ba22c458c3eb9d0edf0c4c25250870c8a60d5 (diff)
Merge pull request #1392 from ThibG/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'app/javascript/flavours/glitch/features/compose/containers/warning_container.js')
-rw-r--r--app/javascript/flavours/glitch/features/compose/containers/warning_container.js17
1 files changed, 16 insertions, 1 deletions
diff --git a/app/javascript/flavours/glitch/features/compose/containers/warning_container.js b/app/javascript/flavours/glitch/features/compose/containers/warning_container.js
index b9b0a2644..ea970c61f 100644
--- a/app/javascript/flavours/glitch/features/compose/containers/warning_container.js
+++ b/app/javascript/flavours/glitch/features/compose/containers/warning_container.js
@@ -6,7 +6,22 @@ import { FormattedMessage } from 'react-intl';
 import { me } from 'flavours/glitch/util/initial_state';
 import { profileLink, termsLink } from 'flavours/glitch/util/backend_links';
 
-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']),