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 <noreply@anthropic.com>
This commit is contained in:
Lizandro Guarnizo
2026-07-03 08:39:07 -05:00
co-authored by Claude Sonnet 4.6
parent 7eea2ff7ba
commit 3f964b424a
2 changed files with 5 additions and 5 deletions
+1 -1
View File
@@ -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"
);
+4 -4
View File
@@ -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]
);