aboutsummaryrefslogtreecommitdiff
path: root/src/services/status_parser/status_parser.js
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-06-12 14:17:56 +0000
committerlain <lain@soykaf.club>2020-06-12 14:17:56 +0000
commitfd109fa355ac491b86d1e10fcbfcdd577f1ac4d7 (patch)
treec27c2f3b684540b10ef9d4477349b4a8681eb7b2 /src/services/status_parser/status_parser.js
parent1946661911c97651ba5356db22a0ddd00ba04864 (diff)
parent48365819d14d80d2aeb7174bca05bf76eee2e8e0 (diff)
Merge branch 'develop' into 'chore/improve-default-tos'
# Conflicts: # static/terms-of-service.html
Diffstat (limited to 'src/services/status_parser/status_parser.js')
-rw-r--r--src/services/status_parser/status_parser.js18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/services/status_parser/status_parser.js b/src/services/status_parser/status_parser.js
index 900cd56e..ed0f6d57 100644
--- a/src/services/status_parser/status_parser.js
+++ b/src/services/status_parser/status_parser.js
@@ -1,15 +1,11 @@
-import sanitize from 'sanitize-html'
+import { filter } from 'lodash'
-export const removeAttachmentLinks = (html) => {
- return sanitize(html, {
- allowedTags: false,
- allowedAttributes: false,
- exclusiveFilter: ({ tag, attribs }) => tag === 'a' && typeof attribs.class === 'string' && attribs.class.match(/attachment/)
+export const muteWordHits = (status, muteWords) => {
+ const statusText = status.text.toLowerCase()
+ const statusSummary = status.summary.toLowerCase()
+ const hits = filter(muteWords, (muteWord) => {
+ return statusText.includes(muteWord.toLowerCase()) || statusSummary.includes(muteWord.toLowerCase())
})
-}
-export const parse = (html) => {
- return removeAttachmentLinks(html)
+ return hits
}
-
-export default parse