mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-28 14:27:00 +02:00
Adds a relay filter to download all reports by the user
This commit is contained in:
@@ -4,6 +4,7 @@ import com.vitorpamplona.amethyst.model.Account
|
|||||||
import com.vitorpamplona.amethyst.model.LocalCache
|
import com.vitorpamplona.amethyst.model.LocalCache
|
||||||
import com.vitorpamplona.amethyst.model.Note
|
import com.vitorpamplona.amethyst.model.Note
|
||||||
import com.vitorpamplona.amethyst.model.UserState
|
import com.vitorpamplona.amethyst.model.UserState
|
||||||
|
import com.vitorpamplona.amethyst.service.model.ReportEvent
|
||||||
import com.vitorpamplona.amethyst.service.model.RepostEvent
|
import com.vitorpamplona.amethyst.service.model.RepostEvent
|
||||||
import nostr.postr.JsonFilter
|
import nostr.postr.JsonFilter
|
||||||
import nostr.postr.events.ContactListEvent
|
import nostr.postr.events.ContactListEvent
|
||||||
@@ -29,6 +30,13 @@ object NostrAccountDataSource: NostrDataSource<Note>("AccountData") {
|
|||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun createAccountReportsFilter(): JsonFilter {
|
||||||
|
return JsonFilter(
|
||||||
|
kinds = listOf(ReportEvent.kind),
|
||||||
|
authors = listOf(account.userProfile().pubkeyHex)
|
||||||
|
)
|
||||||
|
}
|
||||||
|
|
||||||
fun createNotificationFilter() = JsonFilter(
|
fun createNotificationFilter() = JsonFilter(
|
||||||
tags = mapOf("p" to listOf(account.userProfile().pubkeyHex)),
|
tags = mapOf("p" to listOf(account.userProfile().pubkeyHex)),
|
||||||
limit = 200
|
limit = 200
|
||||||
@@ -50,7 +58,8 @@ object NostrAccountDataSource: NostrDataSource<Note>("AccountData") {
|
|||||||
accountChannel.filter = listOf(
|
accountChannel.filter = listOf(
|
||||||
createAccountMetadataFilter(),
|
createAccountMetadataFilter(),
|
||||||
createAccountContactListFilter(),
|
createAccountContactListFilter(),
|
||||||
createNotificationFilter()
|
createNotificationFilter(),
|
||||||
|
createAccountReportsFilter()
|
||||||
).ifEmpty { null }
|
).ifEmpty { null }
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user