Fix reposts without p tag not parsed

This commit is contained in:
futpib
2023-05-07 14:40:57 +04:00
committed by fiatjaf_
parent 424449c773
commit ac7598b5e3
2 changed files with 22 additions and 4 deletions

View File

@@ -55,14 +55,14 @@ export function getRepostedEventPointer(event: Event<number>): undefined | Event
}
}
if (lastETag === undefined || lastPTag === undefined) {
if (lastETag === undefined) {
return undefined
}
return {
id: lastETag[1],
relays: [ lastETag[2], lastPTag[2] ].filter((x) => x !== undefined),
author: lastPTag[1],
relays: [ lastETag[2], lastPTag?.[2] ].filter((x): x is string => typeof x === 'string'),
author: lastPTag?.[1],
}
}