commit 4ff6719961802a4f170af1f8d4b9c2ea12b83b69
parent 5aa19be82ab7df26cabf5137a877fab7c667e452
Author: William Casarin <jb55@jb55.com>
Date: Sun, 17 Apr 2022 15:12:26 -0700
show who we're replying to
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
1 file changed, 21 insertions(+), 0 deletions(-)
diff --git a/damus/Views/ReplyView.swift b/damus/Views/ReplyView.swift
@@ -7,12 +7,33 @@
import SwiftUI
+func all_referenced_pubkeys(_ ev: NostrEvent) -> [ReferencedId] {
+ var keys = ev.referenced_pubkeys
+ let ref = ReferencedId(ref_id: ev.pubkey, relay_id: nil, key: "p")
+ keys.insert(ref, at: 0)
+ return keys
+}
+
struct ReplyView: View {
let replying_to: NostrEvent
+ @EnvironmentObject var profiles: Profiles
+
var body: some View {
VStack {
Text("Replying to:")
+ HStack {
+ let names = all_referenced_pubkeys(replying_to)
+ .map { pubkey in
+ let pk = pubkey.ref_id
+ let prof = profiles.lookup(id: pk)
+ return Profile.displayName(profile: prof, pubkey: pk)
+ }
+ .joined(separator: ", ")
+ Text(names)
+ .foregroundColor(.gray)
+ .font(.footnote)
+ }
EventView(event: replying_to, highlight: .none, has_action_bar: false)
PostView(references: replying_to.reply_ids(pubkey: replying_to.pubkey))