Checks if p tags are user pubkeys when loading drafts.

This commit is contained in:
Vitor Pamplona
2026-03-24 09:33:37 -04:00
parent 94e708b5fc
commit 11dabd46ba
@@ -336,6 +336,7 @@ open class ShortNotePostViewModel :
val currentMentions = val currentMentions =
(replyNote.event as? TextNoteEvent) (replyNote.event as? TextNoteEvent)
?.mentions() ?.mentions()
?.toSet()
?.map { LocalCache.getOrCreateUser(it.pubKey) } ?.map { LocalCache.getOrCreateUser(it.pubKey) }
?: emptyList() ?: emptyList()
@@ -490,8 +491,8 @@ open class ShortNotePostViewModel :
} }
pTags = pTags =
draftEvent.tags.filter { it.size > 1 && it[0] == "p" }.map { draftEvent.tags.filter { it.size > 1 && it[0] == "p" }.mapNotNull {
LocalCache.getOrCreateUser(it[1]) LocalCache.checkGetOrCreateUser(it[1])
} }
draftEvent.tags.filter { it.size > 3 && (it[0] == "e" || it[0] == "a") && it[3] == "fork" }.forEach { draftEvent.tags.filter { it.size > 3 && (it[0] == "e" || it[0] == "a") && it[3] == "fork" }.forEach {
@@ -576,8 +577,8 @@ open class ShortNotePostViewModel :
} }
pTags = pTags =
draftEvent.tags.filter { it.size > 1 && it[0] == "p" }.map { draftEvent.tags.filter { it.size > 1 && it[0] == "p" }.mapNotNull {
LocalCache.getOrCreateUser(it[1]) LocalCache.checkGetOrCreateUser(it[1])
} }
canUsePoll = originalNote == null canUsePoll = originalNote == null
@@ -647,8 +648,8 @@ open class ShortNotePostViewModel :
} }
pTags = pTags =
draftEvent.tags.filter { it.size > 1 && it[0] == "p" }.map { draftEvent.tags.filter { it.size > 1 && it[0] == "p" }.mapNotNull {
LocalCache.getOrCreateUser(it[1]) LocalCache.checkGetOrCreateUser(it[1])
} }
canUsePoll = originalNote == null canUsePoll = originalNote == null