Fix Tags.normalize
This commit is contained in:
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "paravel",
|
"name": "paravel",
|
||||||
"version": "0.4.5",
|
"version": "0.4.6",
|
||||||
"description": "Yet another toolkit for nostr",
|
"description": "Yet another toolkit for nostr",
|
||||||
"author": "hodlbod",
|
"author": "hodlbod",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
|||||||
+4
-1
@@ -180,13 +180,16 @@ export class Tags extends Fluent<string[]> {
|
|||||||
|
|
||||||
// Support the deprecated version where tags are not marked as replies
|
// Support the deprecated version where tags are not marked as replies
|
||||||
normalize() {
|
normalize() {
|
||||||
const tags = this.type(["a", "e"])
|
let tags = this.type(["a", "e"])
|
||||||
|
|
||||||
// If we have a mark, we're not using the legacy format
|
// If we have a mark, we're not using the legacy format
|
||||||
if (tags.any(t => t.length === 4 && ["reply", "root", "mention"].includes(last(t)))) {
|
if (tags.any(t => t.length === 4 && ["reply", "root", "mention"].includes(last(t)))) {
|
||||||
return this
|
return this
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Legacy only supports e tags
|
||||||
|
tags = tags.type("e")
|
||||||
|
|
||||||
const reply = tags.values().last()
|
const reply = tags.values().last()
|
||||||
const root = tags.count() > 1 ? tags.values().first() : null
|
const root = tags.count() > 1 ? tags.values().first() : null
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user