mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-09-28 17:07:28 +02:00
Simplifies comparison for Channels via Hex code instead of objects
This commit is contained in:
@@ -53,13 +53,14 @@ open class Note(val idHex: String) {
|
|||||||
open fun idNote() = id().toNote()
|
open fun idNote() = id().toNote()
|
||||||
open fun idDisplayNote() = idNote().toShortenHex()
|
open fun idDisplayNote() = idNote().toShortenHex()
|
||||||
|
|
||||||
fun channel(): Channel? {
|
fun channelHex(): HexKey? {
|
||||||
val channelHex =
|
return (event as? ChannelMessageEvent)?.channel()
|
||||||
(event as? ChannelMessageEvent)?.channel()
|
?: (event as? ChannelMetadataEvent)?.channel()
|
||||||
?: (event as? ChannelMetadataEvent)?.channel()
|
?: (event as? ChannelCreateEvent)?.id
|
||||||
?: (event as? ChannelCreateEvent)?.id
|
}
|
||||||
|
|
||||||
return channelHex?.let { LocalCache.checkGetOrCreateChannel(it) }
|
fun channel(): Channel? {
|
||||||
|
return channelHex()?.let { LocalCache.checkGetOrCreateChannel(it) }
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun address(): ATag? = null
|
open fun address(): ATag? = null
|
||||||
|
@@ -9,7 +9,7 @@ object GlobalFeedFilter : FeedFilter<Note>() {
|
|||||||
lateinit var account: Account
|
lateinit var account: Account
|
||||||
|
|
||||||
override fun feed(): List<Note> {
|
override fun feed(): List<Note> {
|
||||||
val followChannels = account.followingChannels()
|
val followChannels = account.followingChannels
|
||||||
val followUsers = account.followingKeySet()
|
val followUsers = account.followingKeySet()
|
||||||
val now = System.currentTimeMillis() / 1000
|
val now = System.currentTimeMillis() / 1000
|
||||||
|
|
||||||
@@ -19,7 +19,7 @@ object GlobalFeedFilter : FeedFilter<Note>() {
|
|||||||
it.event is BaseTextNoteEvent && it.replyTo.isNullOrEmpty()
|
it.event is BaseTextNoteEvent && it.replyTo.isNullOrEmpty()
|
||||||
}
|
}
|
||||||
.filter {
|
.filter {
|
||||||
val channel = it.channel()
|
val channel = it.channelHex()
|
||||||
// does not show events already in the public chat list
|
// does not show events already in the public chat list
|
||||||
(channel == null || channel !in followChannels) &&
|
(channel == null || channel !in followChannels) &&
|
||||||
// does not show people the user already follows
|
// does not show people the user already follows
|
||||||
@@ -38,7 +38,7 @@ object GlobalFeedFilter : FeedFilter<Note>() {
|
|||||||
it.event is LongTextNoteEvent && it.replyTo.isNullOrEmpty()
|
it.event is LongTextNoteEvent && it.replyTo.isNullOrEmpty()
|
||||||
}
|
}
|
||||||
.filter {
|
.filter {
|
||||||
val channel = it.channel()
|
val channel = it.channelHex()
|
||||||
// does not show events already in the public chat list
|
// does not show events already in the public chat list
|
||||||
(channel == null || channel !in followChannels) &&
|
(channel == null || channel !in followChannels) &&
|
||||||
// does not show people the user already follows
|
// does not show people the user already follows
|
||||||
|
Reference in New Issue
Block a user