mirror of
https://github.com/MarekWo/mc-webui.git
synced 2026-03-28 17:42:45 +01:00
fix(dm): emit original expected_ack on retry ACK for frontend matching
When a DM is retried, the retry send generates a NEW ack code. The backend correctly maps retry ack → dm_id via _pending_acks, but the WebSocket emit was sending the retry ack code. The frontend DOM still has data-ack="<original_ack>" from the first send, so it could never match retry ACKs → delivery checkmark never appeared. Now both _on_ack() and _confirm_delivery() look up the original expected_ack from the database before emitting to the frontend. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -539,8 +539,16 @@ class DeviceManager:
|
||||
(f" (dm_id={dm_id})" if dm_id else ""))
|
||||
|
||||
if self.socketio:
|
||||
# Emit the ORIGINAL expected_ack (from DB) so frontend can match
|
||||
# the DOM element. Retry sends generate new ack codes, but the
|
||||
# DOM still has the original expected_ack from the first send.
|
||||
original_ack = ack_code
|
||||
if dm_id:
|
||||
dm = self.db.get_dm_by_id(dm_id)
|
||||
if dm and dm.get('expected_ack'):
|
||||
original_ack = dm['expected_ack']
|
||||
self.socketio.emit('ack', {
|
||||
'expected_ack': ack_code,
|
||||
'expected_ack': original_ack,
|
||||
'dm_id': dm_id,
|
||||
'snr': data.get('snr'),
|
||||
'rssi': data.get('rssi'),
|
||||
@@ -1119,8 +1127,13 @@ class DeviceManager:
|
||||
logger.info(f"DM delivery confirmed: dm_id={dm_id}, ack={ack_code}")
|
||||
|
||||
if self.socketio:
|
||||
# Emit original expected_ack so frontend can match the DOM element
|
||||
original_ack = ack_code
|
||||
dm = self.db.get_dm_by_id(dm_id)
|
||||
if dm and dm.get('expected_ack'):
|
||||
original_ack = dm['expected_ack']
|
||||
self.socketio.emit('ack', {
|
||||
'expected_ack': ack_code,
|
||||
'expected_ack': original_ack,
|
||||
'dm_id': dm_id,
|
||||
'snr': data.get('snr'),
|
||||
}, namespace='/chat')
|
||||
|
||||
Reference in New Issue
Block a user