1
0
forked from test/crm

fix: prevent TypeError when concatenating first and last name in WhatsApp messages

The last name on CRM Leads can be empty. In cases where it is, an error occurs: can only concatenate str (not "NoneType") to str. This prevents retrieving messages until a last name is added.

(cherry picked from commit a31795056742daf91d94223bd93f2e7aa13bcea3)
This commit is contained in:
Abraham Kalungi 2025-06-18 15:31:00 +02:00 committed by Mergify
parent 88e5e5e7cc
commit 2f5d5293d0

View File

@ -335,5 +335,5 @@ def get_from_name(message):
else:
from_name = doc.get("lead_name")
else:
from_name = doc.get("first_name") + " " + doc.get("last_name")
from_name = " ".join(filter(None, [doc.get("first_name"), doc.get("last_name")]))
return from_name