up
This commit is contained in:
@@ -335,3 +335,21 @@
|
|||||||
[2026-02-21 11:19:26] Send media by id response: {"messaging_product":"whatsapp","contacts":[{"input":"573022548060","wa_id":"573022548060"}],"messages":[{"id":"wamid.HBgMNTczMDIyNTQ4MDYwFQIAERgSNEI4QkZFQjk2QjEyNkQ4RkMwAA=="}]}
|
[2026-02-21 11:19:26] Send media by id response: {"messaging_product":"whatsapp","contacts":[{"input":"573022548060","wa_id":"573022548060"}],"messages":[{"id":"wamid.HBgMNTczMDIyNTQ4MDYwFQIAERgSNEI4QkZFQjk2QjEyNkQ4RkMwAA=="}]}
|
||||||
[2026-02-21 11:19:26] WhatsApp response (successful): {"messaging_product":"whatsapp","contacts":[{"input":"573022548060","wa_id":"573022548060"}],"messages":[{"id":"wamid.HBgMNTczMDIyNTQ4MDYwFQIAERgSNEI4QkZFQjk2QjEyNkQ4RkMwAA=="}]}
|
[2026-02-21 11:19:26] WhatsApp response (successful): {"messaging_product":"whatsapp","contacts":[{"input":"573022548060","wa_id":"573022548060"}],"messages":[{"id":"wamid.HBgMNTczMDIyNTQ4MDYwFQIAERgSNEI4QkZFQjk2QjEyNkQ4RkMwAA=="}]}
|
||||||
[2026-02-21 11:19:26] Saving to DB - content: image.png, media_url: 25968821909466059, local_file: uploads/media_6999db0b6b3f01.27857143.png, local_thumb: uploads/media_6999db0b6b3f01.27857143.png
|
[2026-02-21 11:19:26] Saving to DB - content: image.png, media_url: 25968821909466059, local_file: uploads/media_6999db0b6b3f01.27857143.png, local_thumb: uploads/media_6999db0b6b3f01.27857143.png
|
||||||
|
[2026-02-21 11:44:57] Raw input: {"recipient":"573022548060","media_url":"https://bot.u-s.app/uploads/media_6999e109e773c4.27559683.png","media_type":"image","caption":null,"filename":"image.png","is_voice":false}
|
||||||
|
[2026-02-21 11:44:57] Input decoded: {"recipient":"573022548060","media_url":"https:\/\/bot.u-s.app\/uploads\/media_6999e109e773c4.27559683.png","media_type":"image","caption":null,"filename":"image.png","is_voice":false}
|
||||||
|
[2026-02-21 11:44:57] is_voice: false
|
||||||
|
[2026-02-21 11:44:57] Local file: /var/www/html/api/../uploads/media_6999e109e773c4.27559683.png exists=yes size=959684
|
||||||
|
[2026-02-21 11:44:59] Upload result: {"id":"1263460085721419"}
|
||||||
|
[2026-02-21 11:44:59] Media ID obtained: 1263460085721419
|
||||||
|
[2026-02-21 11:44:59] Send media by id response: {"messaging_product":"whatsapp","contacts":[{"input":"573022548060","wa_id":"573022548060"}],"messages":[{"id":"wamid.HBgMNTczMDIyNTQ4MDYwFQIAERgSMDZBMUY3QjAwNDdEMzc4OEQ5AA=="}]}
|
||||||
|
[2026-02-21 11:44:59] WhatsApp response (successful): {"messaging_product":"whatsapp","contacts":[{"input":"573022548060","wa_id":"573022548060"}],"messages":[{"id":"wamid.HBgMNTczMDIyNTQ4MDYwFQIAERgSMDZBMUY3QjAwNDdEMzc4OEQ5AA=="}]}
|
||||||
|
[2026-02-21 11:44:59] Saving to DB - content: image.png, media_url: 1263460085721419, local_file: uploads/media_6999e109e773c4.27559683.png, local_thumb: uploads/media_6999e109e773c4.27559683.png
|
||||||
|
[2026-02-21 11:45:15] Raw input: {"recipient":"573022548060","media_url":"https://bot.u-s.app/uploads/media_6999e11b12d2b8.79834878.png","media_type":"image","caption":null,"filename":"image.png","is_voice":false}
|
||||||
|
[2026-02-21 11:45:15] Input decoded: {"recipient":"573022548060","media_url":"https:\/\/bot.u-s.app\/uploads\/media_6999e11b12d2b8.79834878.png","media_type":"image","caption":null,"filename":"image.png","is_voice":false}
|
||||||
|
[2026-02-21 11:45:15] is_voice: false
|
||||||
|
[2026-02-21 11:45:15] Local file: /var/www/html/api/../uploads/media_6999e11b12d2b8.79834878.png exists=yes size=959684
|
||||||
|
[2026-02-21 11:45:16] Upload result: {"id":"883897194529314"}
|
||||||
|
[2026-02-21 11:45:16] Media ID obtained: 883897194529314
|
||||||
|
[2026-02-21 11:45:17] Send media by id response: {"messaging_product":"whatsapp","contacts":[{"input":"573022548060","wa_id":"573022548060"}],"messages":[{"id":"wamid.HBgMNTczMDIyNTQ4MDYwFQIAERgSMzAxOUE0NEQ4QjZDN0E1MDUzAA=="}]}
|
||||||
|
[2026-02-21 11:45:17] WhatsApp response (successful): {"messaging_product":"whatsapp","contacts":[{"input":"573022548060","wa_id":"573022548060"}],"messages":[{"id":"wamid.HBgMNTczMDIyNTQ4MDYwFQIAERgSMzAxOUE0NEQ4QjZDN0E1MDUzAA=="}]}
|
||||||
|
[2026-02-21 11:45:17] Saving to DB - content: image.png, media_url: 883897194529314, local_file: uploads/media_6999e11b12d2b8.79834878.png, local_thumb: uploads/media_6999e11b12d2b8.79834878.png
|
||||||
|
|||||||
+11
-10
@@ -2547,6 +2547,7 @@ if (!isset($_SESSION['user_id'])) {
|
|||||||
|
|
||||||
if (append) {
|
if (append) {
|
||||||
this.conversations = this.conversations.concat(items);
|
this.conversations = this.conversations.concat(items);
|
||||||
|
this._justLoadedMore = true; // evita que renderConversations baje el scroll y dispare otro loadMore
|
||||||
} else {
|
} else {
|
||||||
this.conversations = items;
|
this.conversations = items;
|
||||||
}
|
}
|
||||||
@@ -2688,29 +2689,29 @@ if (!isset($_SESSION['user_id'])) {
|
|||||||
this._prevConversations[c.user_id] = { unread_count: c.unread_count };
|
this._prevConversations[c.user_id] = { unread_count: c.unread_count };
|
||||||
});
|
});
|
||||||
|
|
||||||
// Preserve sidebar scroll position as best-effort: snapshot and restore using delta
|
// Preservar posición visual del scroll del sidebar
|
||||||
try {
|
try {
|
||||||
const prevScrollTop = container.scrollTop;
|
const prevScrollTop = container.scrollTop;
|
||||||
const prevScrollHeight = container.scrollHeight;
|
const prevScrollHeight = container.scrollHeight;
|
||||||
const wasAtTop = prevScrollTop <= 4;
|
const wasAtTop = prevScrollTop <= 4;
|
||||||
|
// Flag: si veníamos de un loadMore (items appended al fondo) NO compensar
|
||||||
|
const wasLoadingMore = !!this._justLoadedMore;
|
||||||
|
this._justLoadedMore = false;
|
||||||
|
|
||||||
container.innerHTML = html;
|
container.innerHTML = html;
|
||||||
void container.offsetHeight; // forzar repaint
|
void container.offsetHeight; // forzar repaint
|
||||||
|
|
||||||
const newScrollHeight = container.scrollHeight;
|
|
||||||
const scrollDelta = newScrollHeight - prevScrollHeight;
|
|
||||||
|
|
||||||
if (wasAtTop) {
|
if (wasAtTop) {
|
||||||
container.scrollTop = 0;
|
container.scrollTop = 0;
|
||||||
|
} else if (wasLoadingMore) {
|
||||||
|
// Items se agregaron al FONDO — mantener posición exacta sin compensar
|
||||||
|
// (compensar causaría que el scroll baje y disparara otro loadMore)
|
||||||
|
container.scrollTop = prevScrollTop;
|
||||||
} else {
|
} else {
|
||||||
// Restaurar posición visual exacta compensando cambio de altura del contenido
|
// Re-render normal (SSE update): compensar cambio de altura
|
||||||
|
const scrollDelta = container.scrollHeight - prevScrollHeight;
|
||||||
container.scrollTop = Math.max(0, prevScrollTop + scrollDelta);
|
container.scrollTop = Math.max(0, prevScrollTop + scrollDelta);
|
||||||
// NOTA: NO llamar scrollIntoView aquí — se ejecuta en cada update SSE
|
|
||||||
// y causa que el scroll baje solo continuamente hasta el fondo.
|
|
||||||
// scrollIntoView solo se llama manualmente al abrir una conversación.
|
|
||||||
}
|
}
|
||||||
|
|
||||||
console.log('✅ renderConversations COMPLETADO');
|
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.warn('renderConversations: scroll preservation failed', e);
|
console.warn('renderConversations: scroll preservation failed', e);
|
||||||
container.innerHTML = html;
|
container.innerHTML = html;
|
||||||
|
|||||||
@@ -497,7 +497,10 @@ class WhatsAppService
|
|||||||
'file' => new CURLFile($filePath, $mimeType),
|
'file' => new CURLFile($filePath, $mimeType),
|
||||||
'type' => $mimeType,
|
'type' => $mimeType,
|
||||||
],
|
],
|
||||||
CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . $this->token],
|
CURLOPT_HTTPHEADER => [
|
||||||
|
'Authorization: Bearer ' . $this->token,
|
||||||
|
'Expect:', // deshabilitar 100-Continue: evita errno 55 (Send failure) con Meta
|
||||||
|
],
|
||||||
CURLOPT_TIMEOUT => 300,
|
CURLOPT_TIMEOUT => 300,
|
||||||
CURLOPT_CONNECTTIMEOUT => 30,
|
CURLOPT_CONNECTTIMEOUT => 30,
|
||||||
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
|
||||||
@@ -624,6 +627,7 @@ class WhatsAppService
|
|||||||
'-w', '%{http_code}',
|
'-w', '%{http_code}',
|
||||||
'-X', 'POST',
|
'-X', 'POST',
|
||||||
'-H', 'Authorization: Bearer ' . $this->token,
|
'-H', 'Authorization: Bearer ' . $this->token,
|
||||||
|
'-H', 'Expect:', // deshabilitar 100-Continue: evita errno 55 con Meta API
|
||||||
'-F', 'messaging_product=whatsapp',
|
'-F', 'messaging_product=whatsapp',
|
||||||
'-F', 'type=' . $mimeType,
|
'-F', 'type=' . $mimeType,
|
||||||
'-F', 'file=@' . $filePath . ';type=' . $mimeType,
|
'-F', 'file=@' . $filePath . ';type=' . $mimeType,
|
||||||
|
|||||||
Reference in New Issue
Block a user