reply bug fixes

still need to revamp this logic for mentions

Signed-off-by: William Casarin <jb55@jb55.com>
This commit is contained in:
William Casarin
2022-04-18 17:31:39 -07:00
parent fd4aa2bb3d
commit 5bb46c5d10
3 changed files with 25 additions and 6 deletions

View File

@@ -33,7 +33,7 @@ struct EventId: Identifiable, CustomStringConvertible {
}
}
class NostrEvent: Codable, Identifiable {
class NostrEvent: Codable, Identifiable, CustomStringConvertible {
var id: String
var sig: String
var tags: [[String]]
@@ -48,6 +48,11 @@ class NostrEvent: Codable, Identifiable {
let created_at: Int64
let kind: Int
let content: String
var description: String {
let p = pow.map { String($0) } ?? "?"
return "NostrEvent { id: \(id) pubkey \(pubkey) kind \(kind) tags \(tags) pow \(p) content '\(content)' }"
}
private enum CodingKeys: String, CodingKey {
case id, sig, tags, pubkey, created_at, kind, content
@@ -140,7 +145,7 @@ class NostrEvent: Codable, Identifiable {
let tag = tags[i]
if tag.count >= 2 && tag[0] == "p" {
c += 1
if ns.count < 3 {
if ns.count < 2 {
ns.append(tag[1])
}
}