Apply wordfilters to attachment alt-texts
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful

This commit is contained in:
sn0w 2024-03-31 03:38:51 +02:00
parent ed0b403c33
commit 6f48569e59
Signed by untrusted user: sn0w
GPG key ID: 52A4BAE175049057

View file

@ -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