fix(adapter): Move-Request auf native Action-Buttons umgestellt
- Move-Request sendet jetzt native RC Buttons (✅Ja, 📍Hier, 📌Generell) statt nummerierter Textoptionen — Button-Garantie eingehalten - Response-Handler erkennt MOVE_REQ:room_id::choice Payloads - Fallback auf Textoptionen bei Button-Send-Fehler - Altes numerisches Format (1/2/3) weiterhin unterstützt
This commit is contained in:
+35
-7
@@ -710,15 +710,20 @@ class RocketChatAdapter(BasePlatformAdapter):
|
||||
return # Nachricht wurde verarbeitet, keine weitere Verarbeitung nötig
|
||||
|
||||
# ── Move-Request-Antwort? (VOR Archivar-Klassifikation!) ────────
|
||||
# Der User antwortet mit "1"/"2"/"3" aus demselben Raum wie die Frage.
|
||||
# Dies MUSS vor dem Archivar geprüft werden, sonst wird "3" als
|
||||
# thematische Frage klassifiziert und ins Catch-All kopiert.
|
||||
# Der User klickt einen Button (MOVE_REQ:room_id::✅Ja) oder antwortet
|
||||
# mit "1"/"2"/"3" aus demselben Raum wie die Frage.
|
||||
# Dies MUSS vor dem Archivar geprüft werden, sonst wird die Antwort
|
||||
# als thematische Frage klassifiziert und ins Catch-All kopiert.
|
||||
if room_id in self._pending_move_requests:
|
||||
move_req = self._pending_move_requests.pop(room_id)
|
||||
choice = text.strip()
|
||||
|
||||
# Normalisiere: "1"/"2"/"3" = numerische Antwort, sonst Text-Match
|
||||
if choice in ("1", "2", "3"):
|
||||
# Neues Format: MOVE_REQ:<room_id>::<choice> (native Buttons)
|
||||
if choice.startswith("MOVE_REQ:") and "::" in choice:
|
||||
_, choice = choice.split("::", 1)
|
||||
choice = choice.strip()
|
||||
# Altes Format: "1"/"2"/"3" = numerische Antwort
|
||||
elif choice in ("1", "2", "3"):
|
||||
num = int(choice)
|
||||
if num == 1:
|
||||
choice = "rüberkopieren"
|
||||
@@ -790,7 +795,30 @@ class RocketChatAdapter(BasePlatformAdapter):
|
||||
target_name = decision.target_room[:12] + "…" # ID-Fragment als Notlösung
|
||||
|
||||
if is_auftrag:
|
||||
# Typ 2: Nummerierte Optionen (keine nativen Buttons im Adapter)
|
||||
# Typ 2: Native Action-Buttons (Button-Garantie)
|
||||
try:
|
||||
from . import _build_custom_buttons
|
||||
move_prefix = f"MOVE_REQ:{room_id}"
|
||||
buttons = _build_custom_buttons(
|
||||
["✅Ja", "📍Hier", "📌Generell"],
|
||||
prefix=move_prefix
|
||||
)
|
||||
note = f"Dein Auftrag passt thematisch besser in **{target_name}**."
|
||||
attachments = [{
|
||||
"color": "#1d74f5",
|
||||
"title": "Wohin soll ich den Auftrag verschieben?",
|
||||
"actions": buttons,
|
||||
}]
|
||||
self._pending_move_requests[room_id] = {
|
||||
"text": text,
|
||||
"origin_room": room_id,
|
||||
"target_room": decision.target_room,
|
||||
"target_name": target_name,
|
||||
"username": username,
|
||||
}
|
||||
self.rest.post_message(room_id, note, attachments=attachments)
|
||||
except Exception:
|
||||
# Fallback: Textoptionen (wenn Button-Send fehlschlägt)
|
||||
note = (
|
||||
f"Dein Auftrag passt thematisch besser in **{target_name}**.\n"
|
||||
f"Antworte mit einer Zahl:\n"
|
||||
@@ -806,7 +834,7 @@ class RocketChatAdapter(BasePlatformAdapter):
|
||||
"username": username,
|
||||
}
|
||||
self.rest.post_message(room_id, note)
|
||||
# Kein Forwarding — auf numerische Antwort warten
|
||||
# Kein Forwarding — auf User-Antwort warten
|
||||
forwarded = True
|
||||
else:
|
||||
# Typ 1: Silent Copy — Nachricht in Zielraum kopieren
|
||||
|
||||
Reference in New Issue
Block a user