From 4b463fecfa0ac2a0e31a44877b94d41858e5b710 Mon Sep 17 00:00:00 2001 From: MarekWo Date: Sun, 1 Mar 2026 13:46:10 +0100 Subject: [PATCH] fix(v2): Resolve DM sender pubkey prefix to full key from contacts Incoming DM events only contain a short pubkey_prefix. Now resolves it to the full public_key via mc.get_contact_by_key_prefix() so incoming and outgoing messages end up in the same conversation. Co-Authored-By: Claude Opus 4.6 --- app/device_manager.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/device_manager.py b/app/device_manager.py index 14f3443..060965c 100644 --- a/app/device_manager.py +++ b/app/device_manager.py @@ -311,12 +311,16 @@ class DeviceManager: content = data.get('text', '') sender_key = data.get('public_key', data.get('pubkey_prefix', '')) - # Look up sender name from contacts (event doesn't include it) + # Look up sender from contacts — resolve prefix to full public key sender_name = 'Unknown' if sender_key and self.mc: contact = self.mc.get_contact_by_key_prefix(sender_key) if contact: sender_name = contact.get('name', sender_key[:8]) + # Use the full public key from contacts (not the short prefix) + full_key = contact.get('public_key', '') + if full_key: + sender_key = full_key if sender_key: self.db.upsert_contact( public_key=sender_key,