mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-11-10 07:37:12 +01:00
Adds hidden words filter to search, hashtag and geotag feeds
Applies hidden words even to hashtags that were not included in the content of the event. Pre-process search to avoid showing and hiding posts after hidden words where processed by the UI.
This commit is contained in:
@@ -107,6 +107,19 @@ open class Event(
|
||||
}
|
||||
}
|
||||
|
||||
override fun anyHashTag(onEach: (str: String) -> Boolean) = anyTagged("t", onEach)
|
||||
|
||||
private fun anyTagged(
|
||||
tagName: String,
|
||||
onEach: (str: String) -> Boolean,
|
||||
) = tags.any {
|
||||
if (it.size > 1 && it[0] == tagName) {
|
||||
onEach(it[1])
|
||||
} else {
|
||||
false
|
||||
}
|
||||
}
|
||||
|
||||
override fun <R> mapTaggedEvent(map: (eventId: HexKey) -> R) = mapTagged("e", map)
|
||||
|
||||
override fun <R> mapTaggedAddress(map: (address: String) -> R) = mapTagged("a", map)
|
||||
|
||||
@@ -121,6 +121,8 @@ interface EventInterface {
|
||||
|
||||
fun forEachHashTag(onEach: (eventId: HexKey) -> Unit)
|
||||
|
||||
fun anyHashTag(onEach: (str: String) -> Boolean): Boolean
|
||||
|
||||
fun <R> mapTaggedEvent(map: (eventId: HexKey) -> R): List<R>
|
||||
|
||||
fun <R> mapTaggedAddress(map: (address: String) -> R): List<R>
|
||||
|
||||
Reference in New Issue
Block a user