Filters lists out of the user's profile

This commit is contained in:
Vitor Pamplona
2023-05-09 12:58:56 -04:00
parent 3287196243
commit 470281fa87
2 changed files with 5 additions and 2 deletions
@@ -82,7 +82,7 @@ object NostrUserProfileDataSource : NostrDataSource("UserProfileFeed") {
TypedFilter( TypedFilter(
types = COMMON_FEED_TYPES, types = COMMON_FEED_TYPES,
filter = JsonFilter( filter = JsonFilter(
kinds = listOf(BookmarkListEvent.kind), kinds = listOf(BookmarkListEvent.kind, PeopleListEvent.kind),
authors = listOf(it.pubkeyHex), authors = listOf(it.pubkeyHex),
limit = 1 limit = 1
) )
@@ -4,6 +4,8 @@ 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.User import com.vitorpamplona.amethyst.model.User
import com.vitorpamplona.amethyst.service.model.BookmarkListEvent
import com.vitorpamplona.amethyst.service.model.PeopleListEvent
object UserProfileNewThreadFeedFilter : FeedFilter<Note>() { object UserProfileNewThreadFeedFilter : FeedFilter<Note>() {
var account: Account? = null var account: Account? = null
@@ -15,7 +17,8 @@ object UserProfileNewThreadFeedFilter : FeedFilter<Note>() {
} }
override fun feed(): List<Note> { override fun feed(): List<Note> {
val longFormNotes = LocalCache.addressables.values.filter { it.author == user } val longFormNotes = LocalCache.addressables.values
.filter { it.author == user && (it.event !is PeopleListEvent && it.event !is BookmarkListEvent) }
return user?.notes return user?.notes
?.plus(longFormNotes) ?.plus(longFormNotes)