ndb: switch profile queries to use transactions

this should ensure no crashing occurs when querying profiles
This commit is contained in:
William Casarin
2023-09-10 14:51:55 -07:00
parent 622a436589
commit fc9b9f2940
51 changed files with 435 additions and 252 deletions

View File

@@ -273,7 +273,8 @@ func mention_str(_ m: Mention<MentionRef>, profiles: Profiles) -> CompatibleText
switch m.ref {
case .pubkey(let pk):
let npub = bech32_pubkey(pk)
let profile = profiles.lookup(id: pk)
let profile_txn = profiles.lookup(id: pk)
let profile = profile_txn.unsafeUnownedValue
let disp = Profile.displayName(profile: profile, pubkey: pk).username.truncate(maxLength: 50)
var attributedString = AttributedString(stringLiteral: "@\(disp)")
attributedString.link = URL(string: "damus:nostr:\(npub)")