mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-06-25 06:50:51 +02:00
Fixes Channel's reply to filtration (removes citations and the channel id from replies)
This commit is contained in:
parent
7012d949c2
commit
8676752f19
@ -565,9 +565,9 @@ object LocalCache {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
val replyTo = event.replyTos()
|
val replyTo = event.tagsWithoutCitations()
|
||||||
|
.filter { it != event.channel() }
|
||||||
.mapNotNull { checkGetOrCreateNote(it) }
|
.mapNotNull { checkGetOrCreateNote(it) }
|
||||||
.filter { it.event !is ChannelCreateEvent }
|
|
||||||
|
|
||||||
note.loadEvent(event, author, replyTo)
|
note.loadEvent(event, author, replyTo)
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@ open class BaseTextNoteEvent(
|
|||||||
sig: HexKey
|
sig: HexKey
|
||||||
) : Event(id, pubKey, createdAt, kind, tags, content, sig) {
|
) : Event(id, pubKey, createdAt, kind, tags, content, sig) {
|
||||||
fun mentions() = taggedUsers()
|
fun mentions() = taggedUsers()
|
||||||
fun replyTos() = tags.filter { it.firstOrNull() == "e" }.mapNotNull { it.getOrNull(1) }
|
open fun replyTos() = tags.filter { it.firstOrNull() == "e" }.mapNotNull { it.getOrNull(1) }
|
||||||
|
|
||||||
fun findCitations(): Set<String> {
|
fun findCitations(): Set<String> {
|
||||||
var citations = mutableSetOf<String>()
|
var citations = mutableSetOf<String>()
|
||||||
|
@ -12,11 +12,10 @@ class ChannelMessageEvent(
|
|||||||
tags: List<List<String>>,
|
tags: List<List<String>>,
|
||||||
content: String,
|
content: String,
|
||||||
sig: HexKey
|
sig: HexKey
|
||||||
) : Event(id, pubKey, createdAt, kind, tags, content, sig) {
|
) : BaseTextNoteEvent(id, pubKey, createdAt, kind, tags, content, sig) {
|
||||||
|
|
||||||
fun channel() = tags.firstOrNull { it[0] == "e" && it.size > 3 && it[3] == "root" }?.getOrNull(1) ?: tags.firstOrNull { it.firstOrNull() == "e" }?.getOrNull(1)
|
fun channel() = tags.firstOrNull { it[0] == "e" && it.size > 3 && it[3] == "root" }?.getOrNull(1) ?: tags.firstOrNull { it.firstOrNull() == "e" }?.getOrNull(1)
|
||||||
fun replyTos() = tags.filter { it.getOrNull(1) != channel() }.mapNotNull { it.getOrNull(1) }
|
override fun replyTos() = tags.filter { it.firstOrNull() == "e" && it.getOrNull(1) != channel() }.mapNotNull { it.getOrNull(1) }
|
||||||
fun mentions() = tags.filter { it.firstOrNull() == "p" }.mapNotNull { it.getOrNull(1) }
|
|
||||||
|
|
||||||
companion object {
|
companion object {
|
||||||
const val kind = 42
|
const val kind = 42
|
||||||
|
Loading…
x
Reference in New Issue
Block a user