feat: show customer names

This commit is contained in:
Vlad Stan 2023-03-27 17:36:08 +03:00
parent 89f46fff35
commit a719517b9c
5 changed files with 19 additions and 38 deletions

View file

@ -253,6 +253,13 @@ async def _handle_nip04_message(merchant_public_key: str, event: NostrEvent):
async def _handle_incoming_dms(
event: NostrEvent, merchant: Merchant, clear_text_msg: str
):
customer = await get_customer(merchant.id, event.pubkey)
if not customer:
await create_customer(
merchant.id, Customer(merchant_id=merchant.id, public_key=event.pubkey)
)
await nostr_client.subscribe_to_user_profile(event.pubkey, 0)
dm_reply = await _handle_dirrect_message(
merchant.id,
merchant.public_key,
@ -265,13 +272,6 @@ async def _handle_incoming_dms(
dm_event = merchant.build_dm_event(dm_reply, event.pubkey)
await nostr_client.publish_nostr_event(dm_event)
customer = await get_customer(merchant.id, event.pubkey)
if not customer:
await create_customer(
merchant.id, Customer(merchant_id=merchant.id, public_key=event.pubkey)
)
await nostr_client.subscribe_to_user_profile(event.pubkey, 0)
async def _handle_outgoing_dms(
event: NostrEvent, merchant: Merchant, clear_text_msg: str