]> cat aescling's git repositories - mastodon.git/commitdiff
[Glitch] Apply filters to poll options in WebUI
authorThibG <thib@sitedethib.com>
Tue, 25 Jun 2019 12:45:14 +0000 (14:45 +0200)
committerThibaut Girka <thib@sitedethib.com>
Wed, 26 Jun 2019 21:19:26 +0000 (23:19 +0200)
Port 47ef4a6c7a74072daff8b23c4af3e300bb75ba1a to glitch-soc

app/javascript/flavours/glitch/actions/importer/normalizer.js

index a8c3fe16a2a946ed8616a0adbd16fe72359c55ed..c19ca82659dd9ab2d1866af191603df8d333ed40 100644 (file)
@@ -55,7 +55,7 @@ export function normalizeStatus(status, normalOldStatus) {
     normalStatus.spoilerHtml = normalOldStatus.get('spoilerHtml');
   } else {
     const spoilerText   = normalStatus.spoiler_text || '';
-    const searchContent = [spoilerText, status.content].join('\n\n').replace(/<br\s*\/?>/g, '\n').replace(/<\/p><p>/g, '\n\n');
+    const searchContent = ([spoilerText, status.content].concat((status.poll && status.poll.options) ? status.poll.options.map(option => option.title) : [])).join('\n\n').replace(/<br\s*\/?>/g, '\n').replace(/<\/p><p>/g, '\n\n');
     const emojiMap      = makeEmojiMap(normalStatus);
 
     normalStatus.search_index = domParser.parseFromString(searchContent, 'text/html').documentElement.textContent;