Skip to content
Python

Mark the relay Slack adapter as drawing buttons

Rohit C Prasad33eb0c1a8570
diff --git a/coworker/connectors/relay_client.py b/coworker/connectors/relay_client.py
index bf862995..485d618f 100644
--- a/coworker/connectors/relay_client.py
+++ b/coworker/connectors/relay_client.py
@@ -230,6 +230,7 @@ class RelayHub:
class SlackRelayAdapter(BasePlatformAdapter):
platform = "slack"
+ supports_interactive = True # Block Kit buttons via `send_interactive`, like the direct adapter
def __init__(
self,
diff --git a/tests/test_inbox_mirror_answerable.py b/tests/test_inbox_mirror_answerable.py
index 060fafa6..522536ab 100644
--- a/tests/test_inbox_mirror_answerable.py
+++ b/tests/test_inbox_mirror_answerable.py
@@ -83,3 +83,20 @@ def test_buttons_still_used_where_the_platform_draws_them(tmp_path):
assert manager.gateway.texts == []
assert len(manager.gateway.interactive_sends) == 1
+
+
+def test_gateway_knows_which_real_adapters_draw_buttons():
+ """Both Slack adapters (Socket Mode and relay) send Block Kit buttons, so the gateway
+ must advertise them; Telegram falls back to text and must not."""
+ from coworker.connectors.adapters import SlackAdapter, TelegramAdapter
+ from coworker.connectors.gateway import Gateway
+ from coworker.connectors.relay_client import SlackRelayAdapter
+
+ assert SlackAdapter.supports_interactive is True
+ assert SlackRelayAdapter.supports_interactive is True
+ assert TelegramAdapter.supports_interactive is False
+
+ gateway = Gateway()
+ gateway.register(SlackRelayAdapter("wss://x", lambda: "jwt", teams={}))
+ assert gateway.supports_interactive("slack:T1:C1") is True
+ assert gateway.supports_interactive("telegram:12345") is False