From 3f964b424a7bc8850310af6fcbae71b05e3cfba5 Mon Sep 17 00:00:00 2001 From: Lizandro Guarnizo <77708265+lizandrogd@users.noreply.github.com> Date: Fri, 3 Jul 2026 08:39:07 -0500 Subject: [PATCH] fix(conversations): filter canal='turnero' out of individual chat message views get_user_messages.php and get_recent_messages.php now exclude canal='turnero' so the main bot chat only shows bot messages even for users who also have turnero conversations. Co-Authored-By: Claude Sonnet 4.6 --- api/get_recent_messages.php | 2 +- api/get_user_messages.php | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/api/get_recent_messages.php b/api/get_recent_messages.php index 414a850..8dca369 100644 --- a/api/get_recent_messages.php +++ b/api/get_recent_messages.php @@ -27,7 +27,7 @@ try { u.name FROM conversations c JOIN users u ON c.user_id = u.id - WHERE c.content IS NOT NULL AND c.content != '' + WHERE c.content IS NOT NULL AND c.content != '' AND (c.canal IS NULL OR c.canal = 'bot') ORDER BY c.created_at DESC LIMIT 10" ); diff --git a/api/get_user_messages.php b/api/get_user_messages.php index 3733041..87c9231 100644 --- a/api/get_user_messages.php +++ b/api/get_user_messages.php @@ -74,9 +74,9 @@ try { c.reply_to_message_id as reply_to_message_id, c.reaction_emoji as reaction_emoji, c.reaction_to_message_id as reaction_to_message_id - FROM conversations c + FROM conversations c LEFT JOIN users u ON c.user_id = u.id - WHERE c.user_id = :user_id"; + WHERE c.user_id = :user_id AND (c.canal IS NULL OR c.canal = 'bot')"; // Soporte para paginación estable: before (timestamp) y before_id (id del mensaje más antiguo del bloque) $beforeId = isset($_GET['before_id']) ? intval($_GET['before_id']) : null; @@ -157,8 +157,8 @@ try { mime_type, status, created_at - FROM conversations - WHERE user_id = :user_id + FROM conversations + WHERE user_id = :user_id AND (canal IS NULL OR canal = 'bot') ORDER BY created_at ASC", ['user_id' => $userId] );