fix: reacciones y audio en chat turnero
- chat_react: guardaba en tabla `messages` en lugar de `conversations` (tabla real del chat) - chat_react: columna era `whatsapp_message_id`; la correcta es `message_id` - chat.php: sendReactionEmoji actualiza la burbuja DOM inmediatamente sin esperar poll - chat_upload_media: mime_content_type() devuelve video/webm en Linux para audio grabado; ahora cualquier mime con "webm" se remapea a audio/ogg antes de determinar mediaType Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Sonnet 4.6
parent
ab72750410
commit
f975844d9d
@@ -931,13 +931,30 @@ function showReactionPicker(e, waId) {
|
||||
async function sendReactionEmoji(emoji) {
|
||||
document.getElementById('reaction-picker').classList.remove('show');
|
||||
if (!_reactionTarget || !state.activeUserId) return;
|
||||
const waId = _reactionTarget;
|
||||
try {
|
||||
await fetch(BASE + API_REACT, {
|
||||
const res = await fetch(BASE + API_REACT, {
|
||||
method: 'POST',
|
||||
headers: { 'Content-Type': 'application/json' },
|
||||
body: JSON.stringify({ user_id: state.activeUserId, message_id: _reactionTarget, emoji })
|
||||
body: JSON.stringify({ user_id: state.activeUserId, message_id: waId, emoji })
|
||||
});
|
||||
await pollMessages();
|
||||
const json = await res.json();
|
||||
if (json.success) {
|
||||
// Actualizar burbuja en el DOM inmediatamente
|
||||
const bubble = document.querySelector(`[data-wa-id="${waId}"]`);
|
||||
if (bubble) {
|
||||
let reEl = bubble.querySelector('.msg-reaction');
|
||||
if (!reEl) {
|
||||
reEl = document.createElement('div');
|
||||
reEl.className = 'msg-reaction';
|
||||
bubble.appendChild(reEl);
|
||||
}
|
||||
reEl.textContent = emoji;
|
||||
}
|
||||
// Actualizar estado en memoria para consistencia
|
||||
const m = state.messages.find(x => x.message_id === waId);
|
||||
if (m) m.reaction_emoji = emoji;
|
||||
}
|
||||
} catch(e) { console.error('reaction:', e); }
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user