forked from AkkomaGang/akkoma-fe
Apply wordfilters to attachment alt-texts
This commit is contained in:
parent
ed0b403c33
commit
6f48569e59
1 changed files with 10 additions and 1 deletions
|
@ -3,8 +3,17 @@ import { filter } from 'lodash'
|
|||
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())
|
||||
muteWord = muteWord.toLowerCase()
|
||||
|
||||
let res = statusText.includes(muteWord) || statusSummary.includes(muteWord)
|
||||
|
||||
for (let attachment of status.attachments) {
|
||||
res |= attachment.description?.toLowerCase().includes(muteWord)
|
||||
}
|
||||
|
||||
return res
|
||||
})
|
||||
|
||||
return hits
|
||||
|
|
Loading…
Reference in a new issue