mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-28 18:17:07 +02:00
Removes new threads, boosts from the Conversations view
This commit is contained in:
@@ -54,16 +54,23 @@ class NostrChatroomListNewFeedViewModel: FeedViewModel(NostrChatroomListDataSour
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun isNewThread(note: Note): Boolean {
|
||||||
|
return note.event is RepostEvent || note.replyTo == null || note.replyTo?.size == 0
|
||||||
|
}
|
||||||
|
|
||||||
class NostrHomeFeedViewModel: FeedViewModel(NostrHomeDataSource) {
|
class NostrHomeFeedViewModel: FeedViewModel(NostrHomeDataSource) {
|
||||||
override fun newListFromDataSource(): List<Note> {
|
override fun newListFromDataSource(): List<Note> {
|
||||||
// Filter: no replies
|
// Filter: no replies
|
||||||
return dataSource.feed().filter {
|
return dataSource.feed().filter { isNewThread(it) }.take(100)
|
||||||
it.event is RepostEvent || it.replyTo == null || it.replyTo?.size == 0
|
|
||||||
}.take(100)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class NostrHomeRepliesFeedViewModel: FeedViewModel(NostrHomeDataSource) {}
|
class NostrHomeRepliesFeedViewModel: FeedViewModel(NostrHomeDataSource) {
|
||||||
|
override fun newListFromDataSource(): List<Note> {
|
||||||
|
// Filter: only replies
|
||||||
|
return dataSource.feed().filter {!isNewThread(it) }.take(100)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
abstract class FeedViewModel(val dataSource: NostrDataSource<Note>): ViewModel() {
|
abstract class FeedViewModel(val dataSource: NostrDataSource<Note>): ViewModel() {
|
||||||
|
Reference in New Issue
Block a user