From bf42ba056e012c15adc8b52c210737917b51e138 Mon Sep 17 00:00:00 2001 From: "Bernd (Hermes)" Date: Sat, 25 Jul 2026 20:26:27 +0200 Subject: [PATCH] =?UTF-8?q?P2-Fix:=20UI-Polish=20=E2=80=94=20Ampelsymbole?= =?UTF-8?q?=20vereinheitlicht=20+=20Room-Map-Summary=20in=20::status?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FIX 1: 🔴/🟢/🟡 durch 🟥/🟩/🟨 ersetzt (Geometric Shapes Extended) - Rocket.Chat rendert 🔴 etwa doppelt so groß wie 🟢/🟡 - 🟥/🟩/🟨 sind alle aus demselben Unicode-Block → konsistente Größe - Betrifft build_help_text (Status-Farben-Sektion) und build_status_text (PresenceEngine-Info) FIX 2: build_status_text erhält Längen-Guard (~5000 Zeichen) - Bei Überschreitung wird die room_map_summary durch kompakte Version ersetzt - Kompakt: nur Raum-Name + Catch-All-Marker, keine Keywords/Themes - ::status zeigt jetzt immer die Raum-Map (vorher nur in ::hilfe, dort oft gekürzt) Tests: 87/87 passed, build_help_text < 4000 chars, build_status_text < 5000 chars --- plugin/archivar/inline_commands.py | 51 ++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 7 deletions(-) diff --git a/plugin/archivar/inline_commands.py b/plugin/archivar/inline_commands.py index b6e157c..2e9552d 100644 --- a/plugin/archivar/inline_commands.py +++ b/plugin/archivar/inline_commands.py @@ -325,9 +325,9 @@ def build_help_text( # P1-4: Status-Farben (Flughafen-Prinzip) — nur wenn PresenceEngine aktiv if presence_enabled: status_emoji = { - "online": "🟢 online (idle, verfügbar)", - "away": "🟡 away (Hintergrund-Task aktiv, Heartbeat pulsiert)", - "busy": "🔴 busy (verarbeitet Nachricht)", + "online": "🟩 online (idle, verfügbar)", + "away": "🟨 away (Hintergrund-Task aktiv, Heartbeat pulsiert)", + "busy": "🟥 busy (verarbeitet Nachricht)", } lines.append("### 🚦 Status-Farben") lines.append("") @@ -420,9 +420,9 @@ def build_status_text( # P1-4: PresenceEngine-Info (nur wenn presence_enabled explizit gesetzt) if presence_enabled is not None: status_labels = { - "online": "🟢 online (idle, verfügbar)", - "away": "🟡 away (Hintergrund-Task aktiv)", - "busy": "🔴 busy (verarbeitet Nachricht)", + "online": "🟩 online (idle, verfügbar)", + "away": "🟨 away (Hintergrund-Task aktiv)", + "busy": "🟥 busy (verarbeitet Nachricht)", } pulse_label = "💓 aktiv" if pulse_active else "⏸️ inaktiv" if presence_enabled: @@ -439,7 +439,44 @@ def build_status_text( lines.append("") lines.append("💡 `::hilfe` für alle Befehle | `::status` für Aktualisierung") - return "\n".join(lines) + result = "\n".join(lines) + + # P2-Fix: Rocket.Chat Payload-Limit ~5000 Zeichen. + # Wenn der Status-Text > 5000 Zeichen ist, ersetze die room_map_summary + # durch eine kompakte Version (nur Raum-Name + Catch-All-Status). + MAX_STATUS_LENGTH = 5000 + if len(result) > MAX_STATUS_LENGTH and room_map_summary: + # Baue kompakte Summary: nur Raum-Name + Catch-All-Marker + compact_lines = ["**Raum-Map (kompakt):**"] + for line in room_map_summary.splitlines(): + stripped = line.strip() + if stripped.startswith(("Rocket.Chat", "Keywords", "Thema:")): + continue + # Zeilen wie " 1. Raumname (roomId) ★ CATCH-ALL — Thema: ..." + if stripped and stripped[0].isdigit(): + # Extrahiere nur den Teil bis zum Catch-All-Marker + # Format: "1. Name (id) ★ CATCH-ALL — Thema: ..." + # oder: "1. Name (id) — Thema: ..." + if "★ CATCH-ALL" in stripped: + idx = stripped.index("★ CATCH-ALL") + len("★ CATCH-ALL") + compact_lines.append(stripped[:idx]) + else: + # Nimm nur "1. Name (id)" — schneide bei " — " ab + dash_idx = stripped.find(" — ") + if dash_idx > 0: + compact_lines.append(stripped[:dash_idx]) + else: + compact_lines.append(stripped) + compact_summary = "\n".join(compact_lines) + + # Ersetze die room_map_summary in lines + for i, line in enumerate(lines): + if line == room_map_summary: + lines[i] = compact_summary + break + result = "\n".join(lines) + + return result # ── Inline-Command-Parser ───────────────────────────────────────────────