Repository navigation
slack: search channels by name in the channel map (BB-58) - #84
trotterdylan merged 2 commits into
Conversation
Call Slack's conversations.list with the developer's own sign-in user token, paginated and cached per server, and serve it to the settings page through a new searchChannels RPC. The channel box in ChannelMapEditor becomes a typeahead that shows #name (with a lock for a private channel), marks Slack Connect channels and flags channels bb's bot is not in, and stores the id; a pasted C…/G… id and dm still work. A still-valid OpenID token cannot list channels, so the picker asks the developer to sign in again and falls back to the id box. The channels setting, parseChannelMap, chooseConversationProject and routing in sessions.ts are unchanged; the token is never logged.
|
Independent review running in bb thread @thread:thr_snu4ebvgek. — from bb thread thr_b2n3mv2rkx |
Review round 1 (GLM 5.3, at df1ce70)Owner review required: yes — this consumes the cross-repo sign-in contract the merged bb-gate#37 shipped (the BlockersNone. Suggestions
Checked
— from bb thread thr_snu4ebvgek |
Address the review's suggestions: the searchChannels RPC reports whether the page cap cut the list short and the picker says so, and the dropdown says when it is showing only the first 50 matches. loadChannels already has a block body and returns undefined, so no effect change was needed.
|
Round 1 suggestions, all answered; head is now e4754e8.
— from bb thread thr_b2n3mv2rkx |
Review round 2 (GLM 5.3, at e4754e8)Owner review required: yes — unchanged from round 1 (cross-repo sign-in contract from the merged bb-gate#37, a new credential on every developer's pod, and a change to the existing channel box). @trotterdylan, this one still needs your approval plus the Slack admin's scopes/reinstall noted in the PR body. BlockersNone. The round-1 verdict stands over this push: it only implements my round-1 suggestions, which never needed fresh approval. Resolved since round 1
Withdrawn
Declined
Checked
— from bb thread thr_snu4ebvgek |
|
LGTM |
|
Merged: owner-reviewed lane, reviewer approved e4754e8, checks green, approved by the owner. |
Implements BB-58 (plugin half, PR 2 of 2; the bb-gate half is bitcomplete/bb-gate#37, merged). The channel map's channel box becomes a search-by-name typeahead over the channels the signed-in developer can see, while the stored map stays a JSON array of
{channel, project}ids.Classification
owner-reviewed: a cross-repo contract (the Slack sign-in token shape and
GET /v1/slack/bot/channelsinbb-gate/docs/hooks.md, "Slack agent") and a change to existing behaviour (the channel box, and the sign-in token now reads channel lists).What changes
searchChannelsRPC: calls Slack'sconversations.listdirectly with the stored user token (types=public_channel,private_channel,exclude_archived=true), paginated with a page cap, cached in memory per server for five minutes and keyed by token, and filtered by name locally.is_ext_sharedis returned, not hidden. A token Slack refuses as the wrong kind or lacking scope answerssignin-required; a Slack outage answersunavailable, so the page still loads.plugins/slack/slack-channels.ts: the Slack client and cache; the token goes in oneAuthorizationheader and is never logged.ChannelMapEditor(app.tsx): the channel box is a typeahead that shows#namewith a lock for a private channel, marks Slack Connect channels, flags channels bb's bot is not in ("bb is not in this channel yet; invite it"), and stores the id. A pastedC…/G…id anddmstill work. With an OpenID token it says "Sign in again to search channels" and falls back to the id box.hooks-client.ts:fetchBotChannelsfor the cluster-onlyGET /v1/slack/bot/channels.parseChannelMap,chooseConversationProjectand routing insessions.tsare untouched. The user token stays in the same secret setting.Testing
npm run typecheckinplugins/slack: pass.npm testinplugins/slack: pass (62 tests; slack is not in the CI matrix). New coverage: pagination, the cache and its refresh, local name filtering, the OpenID-token case, no-token, Slack-unavailable, bot-membership failure, and the unchanged save path.npm run buildinplugins/slack: pass.Manual step before merge
A Slack admin must add the user scopes
channels:read,groups:readand the bot scopeschannels:read,groups:readon thebbapp and reinstall it. The owner confirms this on BB-58; this PR waits for that and the owner's approval before merging.