mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2025-08-08 10:03:12 +02:00
Avoids the need to tag a cited user to count as a citation.
This commit is contained in:
@@ -64,9 +64,9 @@ open class BaseTextNoteEvent(
|
|||||||
return newStyleReply ?: newStyleRoot ?: oldStylePositional
|
return newStyleReply ?: newStyleRoot ?: oldStylePositional
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transient private var citedUsersCache: Set<HexKey>? = null
|
@Transient private var citedUsersCache: Set<String>? = null
|
||||||
|
|
||||||
@Transient private var citedNotesCache: Set<HexKey>? = null
|
@Transient private var citedNotesCache: Set<String>? = null
|
||||||
|
|
||||||
fun citedUsers(): Set<HexKey> {
|
fun citedUsers(): Set<HexKey> {
|
||||||
citedUsersCache?.let {
|
citedUsersCache?.let {
|
||||||
@@ -96,10 +96,8 @@ open class BaseTextNoteEvent(
|
|||||||
val parsed = Nip19.parseComponents(uriScheme, type, key, additionalChars)
|
val parsed = Nip19.parseComponents(uriScheme, type, key, additionalChars)
|
||||||
|
|
||||||
if (parsed != null) {
|
if (parsed != null) {
|
||||||
val tag = tags.firstOrNull { it.size > 1 && it[1] == parsed.hex }
|
if (parsed.type == Nip19.Type.USER) {
|
||||||
|
returningList.add(parsed.hex)
|
||||||
if (tag != null && tag[0] == "p") {
|
|
||||||
returningList.add(tag[1])
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
@@ -142,16 +140,8 @@ open class BaseTextNoteEvent(
|
|||||||
val parsed = Nip19.parseComponents(uriScheme, type, key, additionalChars)
|
val parsed = Nip19.parseComponents(uriScheme, type, key, additionalChars)
|
||||||
|
|
||||||
if (parsed != null) {
|
if (parsed != null) {
|
||||||
try {
|
if (parsed.type == Nip19.Type.EVENT || parsed.type == Nip19.Type.ADDRESS || parsed.type == Nip19.Type.NOTE) {
|
||||||
val tag = tags.firstOrNull { it.size > 1 && it[1] == parsed.hex }
|
citations.add(parsed.hex)
|
||||||
|
|
||||||
if (tag != null && tag[0] == "e") {
|
|
||||||
citations.add(tag[1])
|
|
||||||
}
|
|
||||||
if (tag != null && tag[0] == "a") {
|
|
||||||
citations.add(tag[1])
|
|
||||||
}
|
|
||||||
} catch (e: Exception) {
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user