diff --git a/hermes_cli/gateway.py b/hermes_cli/gateway.py index a0a4d6735e..8cdb856c96 100644 --- a/hermes_cli/gateway.py +++ b/hermes_cli/gateway.py @@ -2100,12 +2100,6 @@ def _setup_dingtalk(): _setup_standard_platform(dingtalk_platform) -def _setup_feishu(): - """Configure Feishu / Lark via the standard platform setup.""" - feishu_platform = next(p for p in _PLATFORMS if p["key"] == "feishu") - _setup_standard_platform(feishu_platform) - - def _setup_wecom(): """Configure WeCom (Enterprise WeChat) via the standard platform setup.""" wecom_platform = next(p for p in _PLATFORMS if p["key"] == "wecom") @@ -2415,7 +2409,6 @@ def _setup_feishu(): "Use DM pairing approval (recommended)", "Allow all direct messages", "Only allow listed user IDs", - "Disable direct messages", ] access_idx = prompt_choice(" How should direct messages be authorized?", access_choices, 0) if access_idx == 0: @@ -2427,16 +2420,12 @@ def _setup_feishu(): save_env_value("FEISHU_ALLOW_ALL_USERS", "true") save_env_value("FEISHU_ALLOWED_USERS", "") print_warning(" Open DM access enabled for Feishu / Lark.") - elif access_idx == 2: + else: save_env_value("FEISHU_ALLOW_ALL_USERS", "false") default_allow = open_id or "" allowlist = prompt(" Allowed user IDs (comma-separated)", default_allow, password=False).replace(" ", "") save_env_value("FEISHU_ALLOWED_USERS", allowlist) print_success(" Allowlist saved.") - else: - save_env_value("FEISHU_ALLOW_ALL_USERS", "false") - save_env_value("FEISHU_ALLOWED_USERS", "") - print_warning(" Direct messages disabled.") # ── Group policy ── print() diff --git a/tests/gateway/test_feishu_onboard.py b/tests/gateway/test_feishu_onboard.py index cb998fa5a9..1ba1a64aa3 100644 --- a/tests/gateway/test_feishu_onboard.py +++ b/tests/gateway/test_feishu_onboard.py @@ -248,6 +248,7 @@ class TestRenderQr: class TestProbeBot: """Tests for bot connectivity verification.""" + @patch("gateway.platforms.feishu.FEISHU_AVAILABLE", True) def test_probe_returns_bot_info_on_success(self): from gateway.platforms.feishu import probe_bot @@ -259,6 +260,7 @@ class TestProbeBot: assert result["bot_name"] == "TestBot" assert result["bot_open_id"] == "ou_bot123" + @patch("gateway.platforms.feishu.FEISHU_AVAILABLE", True) def test_probe_returns_none_on_failure(self): from gateway.platforms.feishu import probe_bot diff --git a/tests/gateway/test_setup_feishu.py b/tests/gateway/test_setup_feishu.py index 0b977cde90..26165528e2 100644 --- a/tests/gateway/test_setup_feishu.py +++ b/tests/gateway/test_setup_feishu.py @@ -181,11 +181,6 @@ class TestSetupFeishuDmPolicy: env = self._run_with_dm_choice(2, prompt_responses=["ou_owner", ""]) assert env["FEISHU_ALLOWED_USERS"] == "ou_owner" - def test_disabled_sets_feishu_allow_all_false(self): - env = self._run_with_dm_choice(3) - assert env["FEISHU_ALLOW_ALL_USERS"] == "false" - assert env["FEISHU_ALLOWED_USERS"] == "" - assert "GATEWAY_ALLOW_ALL_USERS" not in env # ---------------------------------------------------------------------------