fix(dm): show 'Attempt 1/...' immediately after sending DM

The retry progress element was always created empty. The socket event
with the real attempt count could arrive before the DOM was ready,
causing it to be lost. Now pending messages pre-populate with
'Attempt 1/...' which gets updated to the real count when the socket
event arrives.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
MarekWo
2026-03-31 09:47:41 +02:00
parent b60c99aad1
commit 0ecb91aa08
+7 -2
View File
@@ -1208,8 +1208,13 @@ function displayMessages(messages) {
deliveryMeta = `<div class="dm-delivery-meta">${parts.join(', ')}</div>`;
}
// Retry counter placeholder (same line as delivery meta)
const retryInfo = msg.is_own ? `<div class="dm-delivery-meta dm-retry-info" data-dm-id="${msg.id || ''}"></div>` : '';
// Retry counter placeholder — pre-populate for in-progress sends
let retryInfo = '';
if (msg.is_own) {
const isPending = !msg.status || (msg.status !== 'delivered' && msg.status !== 'failed');
const initialText = isPending && msg.expected_ack ? 'Attempt 1/...' : '';
retryInfo = `<div class="dm-delivery-meta dm-retry-info" data-dm-id="${msg.id || ''}">${initialText}</div>`;
}
// Resend button for own messages
const resendBtn = msg.is_own ? `