Fix explicit NIP-10 root/reply/mention markers parsed incorrectly

This commit is contained in:
futpib
2023-04-02 04:01:12 +04:00
committed by fiatjaf_
parent 11ef43abdc
commit 4c464b39cf
2 changed files with 84 additions and 4 deletions

View File

@@ -61,12 +61,27 @@ export function parse(event: Pick<Event, 'tags'>): NIP10Result {
const isFirstETag = eTagIndex === 0
const isLastETag = eTagIndex === eTags.length - 1
if (eTagMarker === 'root' || isFirstETag) {
if (eTagMarker === 'root') {
result.root = eventPointer
continue
}
if (eTagMarker === 'reply' || isLastETag) {
if (eTagMarker === 'reply') {
result.reply = eventPointer
continue
}
if (eTagMarker === 'mention') {
result.mentions.push(eventPointer)
continue
}
if (isFirstETag) {
result.root = eventPointer
continue
}
if (isLastETag) {
result.reply = eventPointer
continue
}