diff options
| author | Henry Jameson <me@hjkos.com> | 2020-05-25 23:38:31 +0300 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2020-05-25 23:38:31 +0300 |
| commit | b5c1d074f83d08473a19a3885f6ff5eeb95274e5 (patch) | |
| tree | f505bbf5e1c57fcccaba7efbdaf3b2ed85f516a7 /src/services/status_parser/status_parser.js | |
| parent | cf3fbdd61096d3e51c09179474f383f8351a33cb (diff) | |
fix reprööted posts not being muted properly. fix muted posts making
desktop notifications
Diffstat (limited to 'src/services/status_parser/status_parser.js')
| -rw-r--r-- | src/services/status_parser/status_parser.js | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/services/status_parser/status_parser.js b/src/services/status_parser/status_parser.js index 900cd56e..3d517e3c 100644 --- a/src/services/status_parser/status_parser.js +++ b/src/services/status_parser/status_parser.js @@ -1,3 +1,4 @@ +import { filter } from 'lodash' import sanitize from 'sanitize-html' export const removeAttachmentLinks = (html) => { @@ -12,4 +13,14 @@ export const parse = (html) => { return removeAttachmentLinks(html) } +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()) + }) + + return hits +} + export default parse |
