fix(dm): persist delivery_status='delivered' on ACK receipt

DM delivery status was lost when switching conversations because
_confirm_delivery() only stored the ACK record and emitted a socket
event, but never set delivery_status='delivered' in direct_messages.

During retries, each attempt generates a new ACK code. The DM record
stores the initial expected_ack, but the actual ACK may arrive for a
later retry's code. The ACK lookup by expected_ack then fails to match.

Now _confirm_delivery() also sets delivery_status='delivered', and
message loading checks this DB field first (like it already did for
'failed'), so delivery persists across page navigations.

Also fixed 213 existing DMs on server via data migration.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
MarekWo
2026-03-29 14:49:37 +02:00
parent 1fdc2eda93
commit 147a12c8f5
2 changed files with 13 additions and 7 deletions
+3
View File
@@ -1669,6 +1669,9 @@ class DeviceManager:
dm_id=dm_id,
)
# Mark delivery_status so reloading messages from DB shows delivered
self.db.update_dm_delivery_status(dm_id, 'delivered')
logger.info(f"DM delivery confirmed: dm_id={dm_id}, ack={ack_code}")
if self.socketio: