diff options
| author | Henry Jameson <me@hjkos.com> | 2020-06-07 00:10:21 +0300 |
|---|---|---|
| committer | Henry Jameson <me@hjkos.com> | 2020-06-07 00:10:21 +0300 |
| commit | 9e3e6b0c6986896db5c484bc5910961ee5585a78 (patch) | |
| tree | 5fbb1a28fdcb4a072806c417a9caa5a057d3e9b8 /src/services/status_parser/status_parser.js | |
| parent | 4fae2f8ea878bedfce89402f19adffaedec65baf (diff) | |
| parent | e47d0f210317c6e04e15fb89eb8f1d469137b779 (diff) | |
Merge remote-tracking branch 'origin/develop' into settings-modal
* origin/develop: (22 commits)
changelog
alignment fixes
Update CHANGELOG.md
StillImage: Make it work properly in both firefox and chrome.
ReactButton: Change the combined emoji (heart) to a simple one.
Linting fixes.
Settings: Keep a local version of the mutedWordsString
MediaModal: Close on browser navigation events.
StatusContent: Try to get hashtag from dataset first.
Docs: Change wrong documentation.
EntityNormalizerSpec: More fixes.
EntityNormalizerSpec: Test new behavior.
EntityNormalizer: Add colons to emoji alt text.
fixed case in class name
The sidebarRight option wasn't being read
Use consistent naming for Pleroma-FE in README
Remove mention of GNU Social
lint
multiple fixes
fix non-mention notifs
...
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 |
