about summary refs log tree commit diff
path: root/app/javascript/flavours/glitch/util
diff options
context:
space:
mode:
authorThibaut Girka <thib@sitedethib.com>2019-02-01 11:41:34 +0100
committerThibG <thib@sitedethib.com>2019-02-01 12:37:28 +0100
commit762e4fdf557ff7cbdd9fce301060f11bb23cb84e (patch)
treef9fd6ab4a0ac293bbc400deb3a5817bf238778de /app/javascript/flavours/glitch/util
parent48d00ac0d9ad703fa3605337b0866c8ce6f21b28 (diff)
Fix hashtag processing when sending toots
This fixes crashes in pleroma when writing toots with a content warning,
since pleroma inserts a “nsfw” hashtag that isn't part of the toot's text.
Diffstat (limited to 'app/javascript/flavours/glitch/util')
-rw-r--r--app/javascript/flavours/glitch/util/hashtag.js4
1 files changed, 2 insertions, 2 deletions
diff --git a/app/javascript/flavours/glitch/util/hashtag.js b/app/javascript/flavours/glitch/util/hashtag.js
index d5ea57662..9b663487f 100644
--- a/app/javascript/flavours/glitch/util/hashtag.js
+++ b/app/javascript/flavours/glitch/util/hashtag.js
@@ -2,7 +2,7 @@ export function recoverHashtags (recognizedTags, text) {
   return recognizedTags.map(tag => {
       const re = new RegExp(`(?:^|[^\/\)\w])#(${tag.name})`, 'i');
       const matched_hashtag = text.match(re);
-      return matched_hashtag ? matched_hashtag[1] : tag;
+      return matched_hashtag ? matched_hashtag[1] : null;
     }
-  );
+  ).filter(x => x !== null);
 }