aboutsummaryrefslogtreecommitdiff
path: root/src/services/status_parser/status_parser.js
diff options
context:
space:
mode:
authorlain <lain@soykaf.club>2020-06-24 17:50:05 +0200
committerlain <lain@soykaf.club>2020-06-24 17:50:05 +0200
commit143da55c56a932e4e88b4959511c59f1d73d37b9 (patch)
tree598cce65273b759d7b064fceaaab20b172d541d3 /src/services/status_parser/status_parser.js
parent7dfa734665bbb74058e221af0f71a88b4f37936d (diff)
parentbbb91d8ae3f1c3d5374de7610e723e63121e8222 (diff)
Merge branch 'develop' of git.pleroma.social:pleroma/pleroma-fe into remove-twitterapi-config
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