filter messages by also looking at media descriptions (#2285)

This commit is contained in:
Mélanie Chauvel 2022-01-04 19:28:49 +01:00 committed by GitHub
commit c0c8eec36b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 40 additions and 3 deletions

View file

@ -29,9 +29,16 @@ class FilterModel @Inject constructor() {
}
val spoilerText = status.actionableStatus.spoilerText
val attachmentsDescriptions = status.attachments
.mapNotNull { it.description }
return (
matcher.reset(status.actionableStatus.content).find() ||
spoilerText.isNotEmpty() && matcher.reset(spoilerText).find()
(spoilerText.isNotEmpty() && matcher.reset(spoilerText).find()) ||
(
attachmentsDescriptions.isNotEmpty() &&
matcher.reset(attachmentsDescriptions.joinToString("\n")).find()
)
)
}