fix(path_hash_mode): echo badge uses echo hash_size, not message path_hash_size

For own (sent) messages, path_len is NULL so path_hash_size defaults to
1, causing echo badge to show 1-byte prefixes (D1, 5E) instead of
2-byte (D103, 5E34) when path_hash_mode>0. Now uses hash_size from the
first echo record (echo_hash_sizes[0]) which carries the correct value
from RX_LOG_DATA parsing.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
MarekWo
2026-03-30 15:22:34 +02:00
parent 2368ec656e
commit a7c5e1a8c3
+8 -2
View File
@@ -1099,7 +1099,10 @@ function updateMessageMetaDOM(wrapper, meta) {
// Update echo badge
if (meta.echo_paths && meta.echo_paths.length > 0) {
const echoPrefixLen = (meta.path_hash_size || 1) * 2;
// For own messages path_hash_size is null — use hash_size from echoes
const echoHashSize = (meta.echo_hash_sizes && meta.echo_hash_sizes.length > 0)
? meta.echo_hash_sizes[0] : (meta.path_hash_size || 1);
const echoPrefixLen = echoHashSize * 2;
const echoPaths = [...new Set(meta.echo_paths.map(p => p.substring(0, echoPrefixLen).toUpperCase()))];
const echoCount = echoPaths.length;
const pathDisplay = echoPaths.length > 0 ? ` (${echoPaths.join(', ')})` : '';
@@ -1184,7 +1187,10 @@ function createMessageElement(msg) {
if (msg.is_own) {
// Own messages: right-aligned, no avatar
// Echo badge shows unique repeaters that heard the message + their path codes
const echoPrefixLen2 = (msg.path_hash_size || 1) * 2;
// For own messages path_hash_size is null — use hash_size from echoes
const echoHS = (msg.echo_hash_sizes && msg.echo_hash_sizes.length > 0)
? msg.echo_hash_sizes[0] : (msg.path_hash_size || 1);
const echoPrefixLen2 = echoHS * 2;
const echoPaths = [...new Set((msg.echo_paths || []).map(p => p.substring(0, echoPrefixLen2).toUpperCase()))];
const echoCount = echoPaths.length;
const pathDisplay = echoPaths.length > 0 ? ` (${echoPaths.join(', ')})` : '';