BugFix for invalid hexes in the hex index
This commit is contained in:
@@ -72,11 +72,11 @@ object LocalCache {
|
|||||||
if (isValidHex(key)) {
|
if (isValidHex(key)) {
|
||||||
val note = getOrCreateNote(key)
|
val note = getOrCreateNote(key)
|
||||||
val noteEvent = note.event
|
val noteEvent = note.event
|
||||||
if (noteEvent is AddressableEvent) {
|
return if (noteEvent is AddressableEvent) {
|
||||||
// upgrade to the latest
|
// upgrade to the latest
|
||||||
return checkGetOrCreateAddressableNote(noteEvent.address().toTag())
|
checkGetOrCreateAddressableNote(noteEvent.address().toTag())
|
||||||
} else {
|
} else {
|
||||||
return note
|
note
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null
|
return null
|
||||||
|
|||||||
@@ -1,7 +1,6 @@
|
|||||||
package com.vitorpamplona.amethyst.model
|
package com.vitorpamplona.amethyst.model
|
||||||
|
|
||||||
import com.vitorpamplona.amethyst.service.checkNotInMainThread
|
import com.vitorpamplona.amethyst.service.checkNotInMainThread
|
||||||
import com.vitorpamplona.amethyst.service.model.ATag
|
|
||||||
import com.vitorpamplona.amethyst.service.model.GenericRepostEvent
|
import com.vitorpamplona.amethyst.service.model.GenericRepostEvent
|
||||||
import com.vitorpamplona.amethyst.service.model.RepostEvent
|
import com.vitorpamplona.amethyst.service.model.RepostEvent
|
||||||
import kotlin.time.ExperimentalTime
|
import kotlin.time.ExperimentalTime
|
||||||
@@ -43,16 +42,7 @@ class ThreadAssembler {
|
|||||||
checkNotInMainThread()
|
checkNotInMainThread()
|
||||||
|
|
||||||
val (result, elapsed) = measureTimedValue {
|
val (result, elapsed) = measureTimedValue {
|
||||||
val note = if (noteId.contains(":")) {
|
val note = LocalCache.checkGetOrCreateNote(noteId) ?: return emptySet<Note>()
|
||||||
val aTag = ATag.parse(noteId, null)
|
|
||||||
if (aTag != null) {
|
|
||||||
LocalCache.getOrCreateAddressableNote(aTag)
|
|
||||||
} else {
|
|
||||||
return emptySet()
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
LocalCache.getOrCreateNote(noteId)
|
|
||||||
}
|
|
||||||
|
|
||||||
if (note.event != null) {
|
if (note.event != null) {
|
||||||
val thread = mutableSetOf<Note>()
|
val thread = mutableSetOf<Note>()
|
||||||
|
|||||||
@@ -1148,7 +1148,7 @@ private fun LoadAndRenderBadge(badgeAwardEventHex: String, nav: (String) -> Unit
|
|||||||
LaunchedEffect(key1 = badgeAwardEventHex) {
|
LaunchedEffect(key1 = badgeAwardEventHex) {
|
||||||
if (baseNote == null) {
|
if (baseNote == null) {
|
||||||
launch(Dispatchers.IO) {
|
launch(Dispatchers.IO) {
|
||||||
baseNote = LocalCache.getOrCreateNote(badgeAwardEventHex)
|
baseNote = LocalCache.checkGetOrCreateNote(badgeAwardEventHex)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user