diff options
| author | HJ <30-hj@users.noreply.git.pleroma.social> | 2020-06-06 20:31:43 +0000 |
|---|---|---|
| committer | HJ <30-hj@users.noreply.git.pleroma.social> | 2020-06-06 20:31:43 +0000 |
| commit | e47d0f210317c6e04e15fb89eb8f1d469137b779 (patch) | |
| tree | 690ea8df1bb58e08ae9ee0f0e87abd1d92c91a7f /src/services/status_parser/status_parser.js | |
| parent | 0a3069aec0c6b664381d202bca5a8460a1d6d9fc (diff) | |
| parent | 7d695fc8f285357393a669d776a1fa1313b0b16d (diff) | |
Merge branch 'fix-reprooted-muted-posts' into 'develop'
Fixed some issues with muting
See merge request pleroma/pleroma-fe!1120
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 |
