fix(P0): button_builder msg-Payload mit :: Suffix — Onboarding-Button-Klick wird wieder erkannt
ROOT CAUSE: button_builder.py setzte msg = prefix (nur 'ONBOARD:<rid>'),
aber _process_onboarding_response erwartet '::' in text als Trigger fuer
Button-Klick-Handler. Ohne '::' -> Fallthrough zu Text-Antwort-Handler
-> Theme wird mit Room-ID als Literal ueberschrieben (stille Korruption).
FIX (Rainer Option B — explizite Signatur):
- build_button_attachments: num_buttons jetzt (label, prefix[, suffix]),
special_buttons (label, prefix, style[, suffix])
- msg_payload = f'{prefix}::{suffix}' wenn suffix, sonst prefix (backward-compat)
- adapter.py: 3 Aufrufer (_send_onboarding_message, _onboarding_next_room,
_finish_onboarding) uebergeben jetzt (clean_name, f'ONBOARD:{rid}', f'select_{rid}')
- Review-Flow (onboarding_review.py) unveraendert — 2-Tupel ohne suffix
bleiben backward-compatibel
This commit is contained in:
+3
-3
@@ -4699,7 +4699,7 @@ class RocketChatAdapter(BasePlatformAdapter):
|
|||||||
for room in missing_rooms:
|
for room in missing_rooms:
|
||||||
rid = room["room_id"]
|
rid = room["room_id"]
|
||||||
clean_name = room["name"].lstrip("#")
|
clean_name = room["name"].lstrip("#")
|
||||||
num_buttons.append((clean_name, f"ONBOARD:{rid}"))
|
num_buttons.append((clean_name, f"ONBOARD:{rid}", f"select_{rid}"))
|
||||||
|
|
||||||
special_buttons = [
|
special_buttons = [
|
||||||
("⏭️ Alle überspringen", "ONBOARD", "default"),
|
("⏭️ Alle überspringen", "ONBOARD", "default"),
|
||||||
@@ -5830,7 +5830,7 @@ class RocketChatAdapter(BasePlatformAdapter):
|
|||||||
for room in remaining:
|
for room in remaining:
|
||||||
rid = room["room_id"]
|
rid = room["room_id"]
|
||||||
clean_name = room["name"].lstrip("#")
|
clean_name = room["name"].lstrip("#")
|
||||||
num_buttons.append((clean_name, f"ONBOARD:{rid}"))
|
num_buttons.append((clean_name, f"ONBOARD:{rid}", f"select_{rid}"))
|
||||||
|
|
||||||
special_buttons = [
|
special_buttons = [
|
||||||
("⏭️ Überspringen", "ONBOARD", "default"),
|
("⏭️ Überspringen", "ONBOARD", "default"),
|
||||||
@@ -5923,7 +5923,7 @@ class RocketChatAdapter(BasePlatformAdapter):
|
|||||||
from archivar.button_builder import build_button_attachments, EMOJI_NUMBERS
|
from archivar.button_builder import build_button_attachments, EMOJI_NUMBERS
|
||||||
num_buttons = []
|
num_buttons = []
|
||||||
for rid, name, is_catch in all_rooms:
|
for rid, name, is_catch in all_rooms:
|
||||||
num_buttons.append((name, f"ONBOARD:{rid}"))
|
num_buttons.append((name, f"ONBOARD:{rid}", f"select_{rid}"))
|
||||||
|
|
||||||
special_buttons = [
|
special_buttons = [
|
||||||
("⏭️ Überspringen", "ONBOARD", "default"),
|
("⏭️ Überspringen", "ONBOARD", "default"),
|
||||||
|
|||||||
@@ -11,15 +11,15 @@ Regeln:
|
|||||||
- Jedes Attachment hat max 3 actions
|
- Jedes Attachment hat max 3 actions
|
||||||
"""
|
"""
|
||||||
|
|
||||||
from typing import List, Tuple
|
from typing import Any, List, Tuple
|
||||||
|
|
||||||
# Emoji-Nummern für bis zu 10 Buttons
|
# Emoji-Nummern für bis zu 10 Buttons
|
||||||
EMOJI_NUMBERS = ["1️⃣", "2️⃣", "3️⃣", "4️⃣", "5️⃣", "6️⃣", "7️⃣", "8️⃣", "9️⃣", "🔟"]
|
EMOJI_NUMBERS = ["1️⃣", "2️⃣", "3️⃣", "4️⃣", "5️⃣", "6️⃣", "7️⃣", "8️⃣", "9️⃣", "🔟"]
|
||||||
|
|
||||||
|
|
||||||
def build_button_attachments(
|
def build_button_attachments(
|
||||||
num_buttons: List[Tuple[str, str]],
|
num_buttons: List[Tuple[Any, ...]],
|
||||||
special_buttons: List[Tuple[str, str, str]],
|
special_buttons: List[Tuple[Any, ...]],
|
||||||
color: str = "#1d74f5",
|
color: str = "#1d74f5",
|
||||||
title: str = "",
|
title: str = "",
|
||||||
number_buttons: bool = True,
|
number_buttons: bool = True,
|
||||||
@@ -34,9 +34,15 @@ def build_button_attachments(
|
|||||||
IMMER in separatem (letztem) Attachment
|
IMMER in separatem (letztem) Attachment
|
||||||
- Jedes Attachment hat max 3 actions
|
- Jedes Attachment hat max 3 actions
|
||||||
|
|
||||||
|
P0-Fix: msg-Payload mit '::' Suffix für Button-Klick-Erkennung.
|
||||||
|
num_buttons: (label, prefix) oder (label, prefix, suffix)
|
||||||
|
special_buttons: (label, prefix, style) oder (label, prefix, suffix, style)
|
||||||
|
Wenn suffix vorhanden: msg = f'{prefix}::{suffix}'
|
||||||
|
Sonst (backward-compat): msg = prefix
|
||||||
|
|
||||||
Args:
|
Args:
|
||||||
num_buttons: Liste von (label, prefix) Tuples für nummerierte Buttons
|
num_buttons: Liste von (label, prefix[, suffix]) Tuples
|
||||||
special_buttons: Liste von (label, prefix, style) Tuples für Sonderschaltflächen
|
special_buttons: Liste von (label, prefix, style[, suffix]) Tuples
|
||||||
color: Attachment-Farbe (default: "#1d74f5")
|
color: Attachment-Farbe (default: "#1d74f5")
|
||||||
title: Attachment-Titel (nur für erstes Attachment)
|
title: Attachment-Titel (nur für erstes Attachment)
|
||||||
number_buttons: Wenn False, werden Buttons NICHT nummeriert
|
number_buttons: Wenn False, werden Buttons NICHT nummeriert
|
||||||
@@ -52,7 +58,11 @@ def build_button_attachments(
|
|||||||
for i in range(0, len(num_buttons), 3):
|
for i in range(0, len(num_buttons), 3):
|
||||||
chunk = num_buttons[i:i + 3]
|
chunk = num_buttons[i:i + 3]
|
||||||
actions = []
|
actions = []
|
||||||
for j, (label, prefix) in enumerate(chunk):
|
for j, tup in enumerate(chunk):
|
||||||
|
label = tup[0]
|
||||||
|
prefix = tup[1]
|
||||||
|
suffix = tup[2] if len(tup) >= 3 else None
|
||||||
|
msg_payload = f"{prefix}::{suffix}" if suffix else prefix
|
||||||
if number_buttons:
|
if number_buttons:
|
||||||
num_idx = i + j
|
num_idx = i + j
|
||||||
emoji = EMOJI_NUMBERS[num_idx] if num_idx < len(EMOJI_NUMBERS) else str(num_idx + 1)
|
emoji = EMOJI_NUMBERS[num_idx] if num_idx < len(EMOJI_NUMBERS) else str(num_idx + 1)
|
||||||
@@ -62,7 +72,7 @@ def build_button_attachments(
|
|||||||
actions.append({
|
actions.append({
|
||||||
"type": "button",
|
"type": "button",
|
||||||
"text": text,
|
"text": text,
|
||||||
"msg": prefix,
|
"msg": msg_payload,
|
||||||
"msg_in_chat_window": True,
|
"msg_in_chat_window": True,
|
||||||
"style": button_style,
|
"style": button_style,
|
||||||
})
|
})
|
||||||
@@ -77,11 +87,16 @@ def build_button_attachments(
|
|||||||
# Sonderschaltflächen in separatem Attachment
|
# Sonderschaltflächen in separatem Attachment
|
||||||
if special_buttons:
|
if special_buttons:
|
||||||
special_actions = []
|
special_actions = []
|
||||||
for label, prefix, style in special_buttons:
|
for tup in special_buttons:
|
||||||
|
label = tup[0]
|
||||||
|
prefix = tup[1]
|
||||||
|
style = tup[2]
|
||||||
|
suffix = tup[3] if len(tup) >= 4 else None
|
||||||
|
msg_payload = f"{prefix}::{suffix}" if suffix else prefix
|
||||||
special_actions.append({
|
special_actions.append({
|
||||||
"type": "button",
|
"type": "button",
|
||||||
"text": label,
|
"text": label,
|
||||||
"msg": prefix,
|
"msg": msg_payload,
|
||||||
"msg_in_chat_window": True,
|
"msg_in_chat_window": True,
|
||||||
"style": style,
|
"style": style,
|
||||||
})
|
})
|
||||||
|
|||||||
Reference in New Issue
Block a user