Fix: Actualizar nombre del chat cuando llega pushName del contacto
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m4s
All checks were successful
build-and-deploy / build-and-deploy (push) Successful in 1m4s
This commit is contained in:
@@ -525,11 +525,13 @@ class BaileysManager extends EventEmitter {
|
||||
return
|
||||
}
|
||||
|
||||
// Ensure chat exists
|
||||
// Ensure chat exists and update name if pushName is available
|
||||
const chatResult = await query<{ id: string }>(
|
||||
`INSERT INTO chats (instance_id, jid, name, is_group)
|
||||
VALUES ($1, $2, $3, $4)
|
||||
ON CONFLICT (instance_id, jid) DO UPDATE SET updated_at = NOW()
|
||||
ON CONFLICT (instance_id, jid) DO UPDATE SET
|
||||
name = COALESCE(NULLIF(EXCLUDED.name, chats.jid), chats.name),
|
||||
updated_at = NOW()
|
||||
RETURNING id`,
|
||||
[instanceId, jid, msg.pushName || jid.split('@')[0], jid.includes('@g.us')]
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user