ndb: sync up a few remaining NdbNote tag differences
This commit is contained in:
@@ -147,22 +147,22 @@ func unfollow_reference(postbox: PostBox, our_contacts: NostrEvent?, keypair: Fu
|
||||
}
|
||||
|
||||
func unfollow_reference_event(our_contacts: NostrEvent, keypair: FullKeypair, unfollow: ReferencedId) -> NostrEvent? {
|
||||
let tags = our_contacts.tags.filter { tag in
|
||||
if let key = tag[safe: 0],
|
||||
let ref = tag[safe: 1],
|
||||
let tags = our_contacts.tags.reduce(into: [[String]]()) { ts, tag in
|
||||
if tag.count >= 2,
|
||||
let fst = unfollow.key.first,
|
||||
let afst = AsciiCharacter(fst),
|
||||
key.matches_char(afst),
|
||||
ref.string() == unfollow.ref_id
|
||||
tag[0].matches_char(afst),
|
||||
tag[1].matches_str(unfollow.ref_id)
|
||||
{
|
||||
return false
|
||||
return
|
||||
}
|
||||
return true
|
||||
|
||||
ts.append(tag.strings())
|
||||
}
|
||||
|
||||
|
||||
let kind = NostrKind.contacts.rawValue
|
||||
|
||||
return NostrEvent(content: our_contacts.content, keypair: keypair.to_keypair(), kind: kind, tags: tags)
|
||||
return NostrEvent(content: our_contacts.content, keypair: keypair.to_keypair(), kind: kind, tags: Array(tags))
|
||||
}
|
||||
|
||||
func follow_user_event(our_contacts: NostrEvent?, keypair: FullKeypair, follow: ReferencedId) -> NostrEvent? {
|
||||
@@ -193,7 +193,7 @@ func remove_relay(ev: NostrEvent, current_relays: [RelayDescriptor], keypair: Fu
|
||||
return nil
|
||||
}
|
||||
|
||||
return NostrEvent(content: content, keypair: keypair.to_keypair(), kind: 3, tags: ev.tags)
|
||||
return NostrEvent(content: content, keypair: keypair.to_keypair(), kind: 3, tags: ev.tags.strings())
|
||||
}
|
||||
|
||||
func add_relay(ev: NostrEvent, keypair: FullKeypair, current_relays: [RelayDescriptor], relay: String, info: RelayInfo) -> NostrEvent? {
|
||||
@@ -209,7 +209,7 @@ func add_relay(ev: NostrEvent, keypair: FullKeypair, current_relays: [RelayDescr
|
||||
return nil
|
||||
}
|
||||
|
||||
return NostrEvent(content: content, keypair: keypair.to_keypair(), kind: 3, tags: ev.tags)
|
||||
return NostrEvent(content: content, keypair: keypair.to_keypair(), kind: 3, tags: ev.tags.strings())
|
||||
}
|
||||
|
||||
func ensure_relay_info(relays: [RelayDescriptor], content: String) -> [String: RelayInfo] {
|
||||
|
||||
@@ -45,7 +45,7 @@ class EventsModel: ObservableObject {
|
||||
return
|
||||
}
|
||||
|
||||
guard last_etag(tags: ev.tags) == target else {
|
||||
guard ev.referenced_ids.last?.ref_id.string() == target else {
|
||||
return
|
||||
}
|
||||
|
||||
|
||||
@@ -214,11 +214,11 @@ class NotificationsModel: ObservableObject, ScrollQueue {
|
||||
|
||||
let id = ref_id.id
|
||||
|
||||
if let evgrp = self.reactions[id] {
|
||||
if let evgrp = self.reactions[id.string()] {
|
||||
return evgrp.insert(ev)
|
||||
} else {
|
||||
let evgrp = EventGroup()
|
||||
self.reactions[id] = evgrp
|
||||
self.reactions[id.string()] = evgrp
|
||||
return evgrp.insert(ev)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,13 +35,12 @@ class ProfileModel: ObservableObject, Equatable {
|
||||
}
|
||||
|
||||
for tag in contacts.tags {
|
||||
guard tag.count >= 2 && tag[0].matches_char("p") else {
|
||||
guard tag.count >= 2,
|
||||
tag[0].matches_char("p"),
|
||||
tag[1].matches_str(pubkey)
|
||||
else {
|
||||
continue
|
||||
}
|
||||
|
||||
if tag[1] == pubkey {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
@@ -145,10 +144,10 @@ class ProfileModel: ObservableObject, Equatable {
|
||||
}
|
||||
|
||||
|
||||
func count_pubkeys(_ tags: [[String]]) -> Int {
|
||||
func count_pubkeys(_ tags: Tags) -> Int {
|
||||
var c: Int = 0
|
||||
for tag in tags {
|
||||
if tag.count >= 2 && tag[0] == "p" {
|
||||
if tag.count >= 2 && tag[0].matches_char("p") {
|
||||
c += 1
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user