dms: always use the other persons pubkey in context menu
The DM view can sometimes show our last message, which means the pubkey in the context menu would be ours. This is super confusing, so always use the other persons pubkey when copying the user id in the DMs view. Changlog-Fixed: Always copy other persons pubkey in DMs context menus
This commit is contained in:
@@ -24,7 +24,7 @@ struct ChatroomView: View {
|
||||
next_ev: ind == count-1 ? nil : thread.events[ind+1],
|
||||
damus_state: damus
|
||||
)
|
||||
.event_context_menu(ev, privkey: damus.keypair.privkey)
|
||||
.event_context_menu(ev, pubkey: ev.pubkey, privkey: damus.keypair.privkey)
|
||||
.onTapGesture {
|
||||
if thread.initial_event.id == ev.id {
|
||||
//dismiss()
|
||||
|
||||
@@ -19,7 +19,7 @@ struct DMChatView: View {
|
||||
VStack(alignment: .leading) {
|
||||
ForEach(Array(zip(dms.events, dms.events.indices)), id: \.0.id) { (ev, ind) in
|
||||
DMView(event: dms.events[ind], damus_state: damus_state)
|
||||
.event_context_menu(ev, privkey: damus_state.keypair.privkey)
|
||||
.event_context_menu(ev, pubkey: ev.pubkey, privkey: damus_state.keypair.privkey)
|
||||
}
|
||||
EndBlock(height: 80)
|
||||
}
|
||||
|
||||
@@ -274,7 +274,7 @@ struct EventView: View {
|
||||
.id(event.id)
|
||||
.frame(maxWidth: .infinity, minHeight: PFP_SIZE)
|
||||
.padding([.bottom], 2)
|
||||
.event_context_menu(event, privkey: damus.keypair.privkey)
|
||||
.event_context_menu(event, pubkey: pubkey, privkey: damus.keypair.privkey)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -313,7 +313,7 @@ extension View {
|
||||
}
|
||||
}
|
||||
|
||||
func event_context_menu(_ event: NostrEvent, privkey: String?) -> some View {
|
||||
func event_context_menu(_ event: NostrEvent, pubkey: String, privkey: String?) -> some View {
|
||||
return self.contextMenu {
|
||||
Button {
|
||||
UIPasteboard.general.string = event.get_content(privkey)
|
||||
@@ -322,7 +322,7 @@ extension View {
|
||||
}
|
||||
|
||||
Button {
|
||||
UIPasteboard.general.string = bech32_pubkey(event.pubkey) ?? event.pubkey
|
||||
UIPasteboard.general.string = bech32_pubkey(pubkey) ?? pubkey
|
||||
} label: {
|
||||
Label("Copy User ID", systemImage: "tag")
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user