mirror of
https://github.com/pablorevilla-meshtastic/meshview.git
synced 2026-07-21 09:02:45 +02:00
Add the Replying to link to the chat page
This commit is contained in:
@@ -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
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user