From e14c4fab061d10a0ade52f85b1b2c1f939a1bb18 Mon Sep 17 00:00:00 2001 From: MarekWo Date: Tue, 9 Jun 2026 19:06:08 +0200 Subject: [PATCH] fix(channels): include message id in /api/messages response MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit /api/messages was dropping channel_messages.id when building the response dict. The frontend therefore had msg.id=undefined for history-loaded rows, so createMessageElement's "typeof msg.id === 'number'" guard suppressed the raw-resend button, and refreshMessagesMeta couldn't find the wrappers either (data-msg-id only gets set when msg.id is truthy). End result: the raw-resend button only appeared on messages sent in the current session and was lost on every channel switch or page reload. Surfacing id costs nothing — the field already exists on the row — and also unblocks any future per-message UI that needs to address the row directly. createMessageElement already handles undefined id correctly for older clients, so this is a one-way frontend benefit. Co-Authored-By: Claude Opus 4.7 --- app/routes/api.py | 1 + 1 file changed, 1 insertion(+) diff --git a/app/routes/api.py b/app/routes/api.py index 25d7d3f..ef31e55 100644 --- a/app/routes/api.py +++ b/app/routes/api.py @@ -470,6 +470,7 @@ def get_messages(): hop_count, path_hash_size, _ = decode_path_len(path_len_raw) msg = { + 'id': row.get('id'), 'sender': row.get('sender', ''), 'content': row.get('content', ''), 'timestamp': row.get('timestamp', 0),