about summary refs log tree commit diff
path: root/app/javascript/mastodon/features/compose
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2020-08-08 19:10:40 +0200
committerThibaut Girka <thib@sitedethib.com>2020-08-08 19:10:40 +0200
commit5d5b9e2f629b1c7077048b36b6e2edda1afe4a60 (patch)
treea6a14149e55924b638afd40589eea6cca82cfe2f /app/javascript/mastodon/features/compose
parenta3806ec6bad5fa0a6034687a863ac8d1f8b0f886 (diff)
parentbd3420b1398c4c4ab2e2f2850b6dd6eaff0d361b (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/components/emoji_picker_dropdown.js2
-rw-r--r--app/javascript/mastodon/features/compose/containers/warning_container.js40
2 files changed, 25 insertions, 17 deletions
diff --git a/app/javascript/mastodon/features/compose/components/emoji_picker_dropdown.js b/app/javascript/mastodon/features/compose/components/emoji_picker_dropdown.js
index 360a7af6a..e8a36a923 100644
--- a/app/javascript/mastodon/features/compose/components/emoji_picker_dropdown.js
+++ b/app/javascript/mastodon/features/compose/components/emoji_picker_dropdown.js
@@ -315,7 +315,7 @@ class EmojiPickerDropdown extends React.PureComponent {
 
         this.setState({ loading: false });
       }).catch(() => {
-        this.setState({ loading: false });
+        this.setState({ loading: false, active: false });
       });
     }
 
diff --git a/app/javascript/mastodon/features/compose/containers/warning_container.js b/app/javascript/mastodon/features/compose/containers/warning_container.js
index 947d20c5a..bf0660ea9 100644
--- a/app/javascript/mastodon/features/compose/containers/warning_container.js
+++ b/app/javascript/mastodon/features/compose/containers/warning_container.js
@@ -5,22 +5,30 @@ import PropTypes from 'prop-types';
 import { FormattedMessage } from 'react-intl';
 import { me } from '../../../initial_state';
 
-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 buildHashtagRE = () => {
+  try {
+    const HASHTAG_SEPARATORS = '_\\u00b7\\u200c';
+    const ALPHA = '\\p{L}\\p{M}';
+    const WORD = '\\p{L}\\p{M}\\p{N}\\p{Pc}';
+    return new RegExp(
+      '(?:^|[^\\/\\)\\w])#((' +
+      '[' + WORD + '_]' +
+      '[' + WORD + HASHTAG_SEPARATORS + ']*' +
+      '[' + ALPHA + HASHTAG_SEPARATORS + ']' +
+      '[' + WORD + HASHTAG_SEPARATORS +']*' +
+      '[' + WORD + '_]' +
+      ')|(' +
+      '[' + WORD + '_]*' +
+      '[' + ALPHA + ']' +
+      '[' + WORD + '_]*' +
+      '))', 'iu',
+    );
+  } catch {
+    return /(?:^|[^\/\)\w])#(\w*[a-zA-Z·]\w*)/i;
+  }
+};
+
+const APPROX_HASHTAG_RE = buildHashtagRE();
 
 const mapStateToProps = state => ({
   needsLockWarning: state.getIn(['compose', 'privacy']) === 'private' && !state.getIn(['accounts', me, 'locked']),