P-051: action_id in allen Button-Dicts ergänzen (RC 6.x Rendering-Fix)

- button_builder.py: _make_action_id() Helper + action_id in Regular/Special Buttons
- __init__.py _build_custom_buttons: action_id via SHA1(msg_payload:idx)
- adapter.py _get_build_custom_buttons local fallback: action_id ergänzt
- adapter.py send_clarify: action_id=f'clarify_{clarify_id}_{i}' (deterministisch)
- adapter.py _send_archivar_buttons: action_id via SHA1(selector:i)

Rocket.Chat 6.x ignoriert das actions-Array komplett wenn kein action_id-Feld
vorhanden ist. Buttons erscheinen als plain-text statt klickbar.
This commit is contained in:
Bernd (Hermes)
2026-08-11 21:39:07 +02:00
parent 338fa14bbb
commit 328532bcbb
3 changed files with 31 additions and 3 deletions
+4
View File
@@ -81,6 +81,7 @@ def _build_custom_buttons(labels: list, prefix: str = "", style: str = "default"
prefix: Payload prefix for correlation (e.g. "ONBOARD:<rid>")
style: Rocket.Chat button style — "default" (grey) or "primary" (blue)
"""
import hashlib
buttons = []
for idx, label in enumerate(labels):
# Sanitize label for button text (keep short)
@@ -89,12 +90,15 @@ def _build_custom_buttons(labels: list, prefix: str = "", style: str = "default"
msg_payload = display
if prefix:
msg_payload = f"{prefix}::{msg_payload}"
# P-051: action_id zwingend für RC 6.x (sonst actions-Array ignoriert)
action_id = hashlib.sha1(f"{msg_payload}:{idx}".encode()).hexdigest()[:12]
buttons.append({
"type": "button",
"text": display,
"msg": msg_payload,
"msg_in_chat_window": True,
"style": style,
"action_id": action_id,
})
return buttons