diff --git a/api/react_message.php b/api/react_message.php index 469a7e5..131a5ce 100644 --- a/api/react_message.php +++ b/api/react_message.php @@ -49,7 +49,8 @@ try { // Registrar la reacción en el mensaje objetivo (no crear un nuevo "reaction" como mensaje saliente) try { - $update = ['reaction_emoji' => $emoji, 'reaction_to_message_id' => $message_id, 'updated_at' => date('Y-m-d H:i:s')]; + // Avoid updating `updated_at` because older schemas may not have it + $update = ['reaction_emoji' => $emoji, 'reaction_to_message_id' => $message_id]; // If send failed, optionally record a status on target (not mandatory) if (!$resp) $update['reaction_status'] = 'failed'; diff --git a/api/webhook.php b/api/webhook.php index db916f7..7984023 100644 --- a/api/webhook.php +++ b/api/webhook.php @@ -253,7 +253,7 @@ class WhatsAppWebhook { // Try to update the referenced message (by message_id or id) $updated = $this->db->update( 'conversations', - ['reaction_emoji' => $emoji, 'reaction_to_message_id' => $reactionTo, 'updated_at' => date('Y-m-d H:i:s')], + ['reaction_emoji' => $emoji, 'reaction_to_message_id' => $reactionTo], 'message_id = :mid OR id = :mid', ['mid' => $reactionTo] ); diff --git a/conversations.php b/conversations.php index 73d9233..fd712a7 100644 --- a/conversations.php +++ b/conversations.php @@ -2145,11 +2145,14 @@ let earliestId = null; // local var for earliest message id if (data && data.success && Array.isArray(data.data)) { messages = data.data; + // Filtrar mensajes de tipo 'reaction' para que no aparezcan como elementos en la conversación + messages = messages.filter(m => !(m && m.message_type === 'reaction')); hasMore = !!data.has_more; earliest = data.earliest || (messages[0] && messages[0].created_at) || null; earliestId = data.earliest_id || (messages[0] && messages[0].id) || null; } else if (Array.isArray(data)) { messages = data; + messages = messages.filter(m => !(m && m.message_type === 'reaction')); } // Filtrar mensajes vacíos (sin texto y sin media) para evitar que aparezcan placeholders "[Mensaje vacío]"