From 2a92267bf4f44745390ec07c7a424b870d6cae77 Mon Sep 17 00:00:00 2001 From: "Bernd (Hermes)" Date: Fri, 24 Jul 2026 14:34:13 +0200 Subject: [PATCH] fix(P1-4,P1-5): _onboarding_next_room + _finish_onboarding 3er-Chunking --- plugin/adapter.py | 71 +++++++++++++++++++++-------------------------- 1 file changed, 31 insertions(+), 40 deletions(-) diff --git a/plugin/adapter.py b/plugin/adapter.py index b39d3cf..6b17350 100644 --- a/plugin/adapter.py +++ b/plugin/adapter.py @@ -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")