commit b5f13636ae3145a0ab5e3c4ea0aca428bd29a5be
parent eec8763733adb99f47d2581cd463f310a13a9522
Author: William Casarin <jb55@jb55.com>
Date: Tue, 9 Aug 2022 09:59:10 -0700
fix mentions in DMs again
Signed-off-by: William Casarin <jb55@jb55.com>
Diffstat:
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/damus/Views/DMChatView.swift b/damus/Views/DMChatView.swift
@@ -106,11 +106,12 @@ struct DMChatView: View {
}
func send_message() {
+ let tags = [["p", pubkey]]
let post_blocks = parse_post_blocks(content: message)
- let post_tags = make_post_tags(post_blocks: post_blocks, tags: [])
+ let post_tags = make_post_tags(post_blocks: post_blocks, tags: tags)
let content = render_blocks(blocks: post_tags.blocks)
- guard let dm = create_dm(content, to_pk: pubkey, keypair: damus_state.keypair) else {
+ guard let dm = create_dm(content, to_pk: pubkey, tags: post_tags.tags, keypair: damus_state.keypair) else {
print("error creating dm")
return
}
@@ -149,13 +150,12 @@ struct DMChatView_Previews: PreviewProvider {
}
-func create_dm(_ message: String, to_pk: String, keypair: Keypair) -> NostrEvent?
+func create_dm(_ message: String, to_pk: String, tags: [[String]], keypair: Keypair) -> NostrEvent?
{
guard let privkey = keypair.privkey else {
return nil
}
- let tags = [["p", to_pk]]
let iv = random_bytes(count: 16).bytes
guard let shared_sec = get_shared_secret(privkey: privkey, pubkey: to_pk) else {
return nil