fix(P1-4,P1-5): _onboarding_next_room + _finish_onboarding 3er-Chunking
This commit is contained in:
+31
-40
@@ -6005,29 +6005,25 @@ class RocketChatAdapter(BasePlatformAdapter):
|
||||
lines.append("👉 Klicke auf eine Nummer, um den Raum einzurichten:")
|
||||
|
||||
_build = self._get_build_custom_buttons()
|
||||
EMOJI_NUMBERS = ["1️⃣", "2️⃣", "3️⃣", "4️⃣", "5️⃣", "6️⃣", "7️⃣", "8️⃣", "9️⃣", "🔟"]
|
||||
buttons = []
|
||||
for i, room in enumerate(remaining):
|
||||
# P1-4: build_button_attachments für 3er-Chunking
|
||||
from archivar.button_builder import build_button_attachments, EMOJI_NUMBERS
|
||||
num_buttons = []
|
||||
for room in remaining:
|
||||
rid = room["room_id"]
|
||||
emoji = EMOJI_NUMBERS[i] if i < len(EMOJI_NUMBERS) else f"{i+1}."
|
||||
prefix = f"ONBOARD:{rid}"
|
||||
buttons.extend(_build(
|
||||
[emoji],
|
||||
prefix=prefix,
|
||||
style="primary"
|
||||
))
|
||||
clean_name = room["name"].lstrip("#")
|
||||
num_buttons.append((clean_name, f"ONBOARD:{rid}"))
|
||||
|
||||
# Globale Buttons (style='default' = grau)
|
||||
buttons.extend(_build(
|
||||
["⏭️ Überspringen", "⏰ Später"],
|
||||
prefix="ONBOARD"
|
||||
))
|
||||
special_buttons = [
|
||||
("⏭️ Überspringen", "ONBOARD", "default"),
|
||||
("⏰ Später", "ONBOARD", "default"),
|
||||
]
|
||||
|
||||
attachments = [{
|
||||
"color": "#1d74f5",
|
||||
"title": "Weitere Räume einrichten?",
|
||||
"actions": buttons,
|
||||
}]
|
||||
attachments = build_button_attachments(
|
||||
num_buttons,
|
||||
special_buttons,
|
||||
color="#1d74f5",
|
||||
title="Weitere Räume einrichten?",
|
||||
)
|
||||
await self._post_message_with_retry(operator_room_id, "\n".join(lines), attachments=attachments)
|
||||
else:
|
||||
await self._finish_onboarding(operator_room_id)
|
||||
@@ -6104,27 +6100,22 @@ class RocketChatAdapter(BasePlatformAdapter):
|
||||
lines.append("👉 Klicke auf eine Nummer, um den Catch-All-Raum zu wählen:")
|
||||
|
||||
_build = self._get_build_custom_buttons()
|
||||
EMOJI_NUMBERS = ["1️⃣", "2️⃣", "3️⃣", "4️⃣", "5️⃣", "6️⃣", "7️⃣", "8️⃣", "9️⃣", "🔟"]
|
||||
buttons = []
|
||||
for i, (rid, name, is_catch) in enumerate(all_rooms):
|
||||
emoji = EMOJI_NUMBERS[i] if i < len(EMOJI_NUMBERS) else f"{i+1}."
|
||||
prefix = f"ONBOARD:{rid}"
|
||||
buttons.extend(_build(
|
||||
[emoji],
|
||||
prefix=prefix,
|
||||
style="primary"
|
||||
))
|
||||
# Globaler Überspringen-Button
|
||||
buttons.extend(_build(
|
||||
["⏭️ Überspringen"],
|
||||
prefix="ONBOARD"
|
||||
))
|
||||
# P1-5: build_button_attachments für 3er-Chunking
|
||||
from archivar.button_builder import build_button_attachments, EMOJI_NUMBERS
|
||||
num_buttons = []
|
||||
for rid, name, is_catch in all_rooms:
|
||||
num_buttons.append((name, f"ONBOARD:{rid}"))
|
||||
|
||||
attachments = [{
|
||||
"color": "#1d74f5",
|
||||
"title": "Catch-All-Raum wählen",
|
||||
"actions": buttons,
|
||||
}]
|
||||
special_buttons = [
|
||||
("⏭️ Überspringen", "ONBOARD", "default"),
|
||||
]
|
||||
|
||||
attachments = build_button_attachments(
|
||||
num_buttons,
|
||||
special_buttons,
|
||||
color="#1d74f5",
|
||||
title="Catch-All-Raum wählen",
|
||||
)
|
||||
await self._post_message_with_retry(operator_room_id, "\n".join(lines), attachments=attachments)
|
||||
logger.info("[rocketchat] Onboarding v2 abgeschlossen: alle Räume eingerichtet")
|
||||
|
||||
|
||||
Reference in New Issue
Block a user