debug: add deep logging to message send flow (frontend + backend)
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
Some checks are pending
NordaBiz Tests / Unit & Integration Tests (push) Waiting to run
NordaBiz Tests / E2E Tests (Playwright) (push) Blocked by required conditions
NordaBiz Tests / Smoke Tests (Production) (push) Blocked by required conditions
NordaBiz Tests / Send Failure Notification (push) Blocked by required conditions
This commit is contained in:
parent
86d9262c3e
commit
9151e4efa0
@ -183,6 +183,8 @@ def get_messages(conv_id):
|
|||||||
@member_required
|
@member_required
|
||||||
def send_message(conv_id):
|
def send_message(conv_id):
|
||||||
"""Send a message to a conversation."""
|
"""Send a message to a conversation."""
|
||||||
|
import logging
|
||||||
|
logging.getLogger(__name__).info(f"[MSG-DEBUG] send_message called: conv={conv_id}, user={current_user.id}, method={request.method}")
|
||||||
db = SessionLocal()
|
db = SessionLocal()
|
||||||
try:
|
try:
|
||||||
# Verify membership
|
# Verify membership
|
||||||
|
|||||||
@ -1211,6 +1211,7 @@
|
|||||||
if (e.key === 'Enter' && !e.shiftKey) {
|
if (e.key === 'Enter' && !e.shiftKey) {
|
||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
e.stopImmediatePropagation();
|
e.stopImmediatePropagation();
|
||||||
|
console.log('[MSG-DEBUG] Enter keydown captured, _isSending=' + state._isSending + ', _lastSendTime=' + state._lastSendTime);
|
||||||
Composer.send();
|
Composer.send();
|
||||||
}
|
}
|
||||||
}, true);
|
}, true);
|
||||||
@ -1224,6 +1225,7 @@
|
|||||||
var sendBtn = document.getElementById('sendBtn');
|
var sendBtn = document.getElementById('sendBtn');
|
||||||
if (sendBtn) {
|
if (sendBtn) {
|
||||||
sendBtn.addEventListener('click', function () {
|
sendBtn.addEventListener('click', function () {
|
||||||
|
console.log('[MSG-DEBUG] Send BUTTON clicked');
|
||||||
Composer.send();
|
Composer.send();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -1254,14 +1256,23 @@
|
|||||||
|
|
||||||
send: async function () {
|
send: async function () {
|
||||||
if (!state.currentConversationId || !state.quill) return;
|
if (!state.currentConversationId || !state.quill) return;
|
||||||
if (state._isSending) return; // Prevent double send
|
// Double-send guard: flag + timestamp debounce (500ms)
|
||||||
|
var now = Date.now();
|
||||||
|
if (state._isSending || (state._lastSendTime && now - state._lastSendTime < 500)) {
|
||||||
|
console.log('[MSG-DEBUG] send() BLOCKED: _isSending=' + state._isSending + ', timeSinceLast=' + (now - (state._lastSendTime || 0)) + 'ms');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
state._isSending = true;
|
||||||
|
state._lastSendTime = now;
|
||||||
|
console.log('[MSG-DEBUG] send() EXECUTING at ' + now);
|
||||||
|
|
||||||
var html = state.quill.root.innerHTML;
|
var html = state.quill.root.innerHTML;
|
||||||
var text = state.quill.getText().trim();
|
var text = state.quill.getText().trim();
|
||||||
|
|
||||||
if (!text && !state.attachedFiles.length) return;
|
if (!text && !state.attachedFiles.length) {
|
||||||
|
state._isSending = false;
|
||||||
state._isSending = true;
|
return;
|
||||||
|
}
|
||||||
var convId = state.currentConversationId;
|
var convId = state.currentConversationId;
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user