Apply wordfilters to attachment alt-texts
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
All checks were successful
ci/woodpecker/pr/woodpecker Pipeline was successful
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) => {
|
export const muteWordHits = (status, muteWords) => {
|
||||||
const statusText = status.text.toLowerCase()
|
const statusText = status.text.toLowerCase()
|
||||||
const statusSummary = status.summary.toLowerCase()
|
const statusSummary = status.summary.toLowerCase()
|
||||||
|
|
||||||
const hits = filter(muteWords, (muteWord) => {
|
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
|
return hits
|
||||||
|
|
Loading…
Reference in a new issue