Add the Replying to link to the chat page

This commit is contained in:
Pablo Revilla
2025-08-12 14:59:17 -07:00
parent f2afd3d0ee
commit ef105a0928
2 changed files with 22 additions and 10 deletions
+2 -2
View File
@@ -133,8 +133,8 @@ async function fetchUpdates() {
</span> </span>
<span class="col-5 message"> <span class="col-5 message">
${escapeHtml(packet.payload)} ${escapeHtml(packet.payload)}
${packet.raw_mesh_packet && packet.raw_mesh_packet.decoded && packet.raw_mesh_packet.decoded.reply_id ${packet.reply_id
? `<span class="replying-to">(Replying to: <a href="/packet/${packet.raw_mesh_packet.decoded.reply_id}">${packet.raw_mesh_packet.decoded.reply_id}</a>)</span>` ? `<span class="replying-to">(Replying to: <a href="/packet/${packet.reply_id}">${packet.reply_id}</a>)</span>`
: ''} : ''}
</span> </span>
`; `;
+20 -8
View File
@@ -1287,14 +1287,26 @@ async def chat_updates(request):
filtered_packets = [p for p in ui_packets if not SEQ_REGEX.fullmatch(p.payload)] filtered_packets = [p for p in ui_packets if not SEQ_REGEX.fullmatch(p.payload)]
new_packets = [p for p in filtered_packets if p.import_time > last_time] new_packets = [p for p in filtered_packets if p.import_time > last_time]
packets_data = [{ packets_data = []
"id": p.id, for p in new_packets:
"import_time": p.import_time.isoformat(), reply_id = None
"channel": p.from_node.channel if p.from_node else "", if getattr(p, 'raw_mesh_packet', None):
"from_node_id": p.from_node_id, decoded = getattr(p.raw_mesh_packet, 'decoded', None)
"long_name": p.from_node.long_name if p.from_node else "", if decoded:
"payload": p.payload, reply_id = getattr(decoded, 'reply_id', None)
} for p in new_packets]
packet_dict = {
"id": p.id,
"import_time": p.import_time.isoformat(),
"channel": p.from_node.channel if p.from_node else "",
"from_node_id": p.from_node_id,
"long_name": p.from_node.long_name if p.from_node else "",
"payload": p.payload,
}
if reply_id:
packet_dict["reply_id"] = reply_id
packets_data.append(packet_dict)
response = { response = {
"packets": packets_data "packets": packets_data