fix(messages): remove tempId reference in _doSend, use content matching, no alert
Some checks failed
NordaBiz Tests / Unit & Integration Tests (push) Has been cancelled
NordaBiz Tests / E2E Tests (Playwright) (push) Has been cancelled
NordaBiz Tests / Smoke Tests (Production) (push) Has been cancelled
NordaBiz Tests / Send Failure Notification (push) Has been cancelled
Some checks failed
NordaBiz Tests / Unit & Integration Tests (push) Has been cancelled
NordaBiz Tests / E2E Tests (Playwright) (push) Has been cancelled
NordaBiz Tests / Smoke Tests (Production) (push) Has been cancelled
NordaBiz Tests / Send Failure Notification (push) Has been cancelled
This commit is contained in:
parent
406752fca2
commit
77f5277372
@ -1368,13 +1368,18 @@
|
||||
|
||||
var result = await api('/api/conversations/' + convId + '/messages', 'POST', fd);
|
||||
|
||||
// Replace temp ID with real ID in state so polling dedup works
|
||||
// Update optimistic message in state with real data (for dedup)
|
||||
var msgs = state.messages[convId];
|
||||
if (msgs) {
|
||||
var stripped = (html || '').replace(/<[^>]*>/g, '').trim();
|
||||
for (var i = msgs.length - 1; i >= 0; i--) {
|
||||
if (msgs[i].id === tempId) {
|
||||
msgs[i] = result;
|
||||
break;
|
||||
if (msgs[i]._optimistic && msgs[i].sender_id === result.sender_id) {
|
||||
var mc = (msgs[i].content || '').replace(/<[^>]*>/g, '').trim();
|
||||
if (mc === stripped) {
|
||||
msgs[i].id = result.id;
|
||||
msgs[i]._optimistic = false;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1390,9 +1395,7 @@
|
||||
updated_at: result.created_at,
|
||||
});
|
||||
} catch (e) {
|
||||
alert('Nie udało się wysłać wiadomości: ' + e.message);
|
||||
} finally {
|
||||
state._isSending = false;
|
||||
console.error('Nie udało się wysłać wiadomości:', e.message);
|
||||
}
|
||||
},
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user