feat(ui): pick a Slack channel and send a test message - #12436
feat(ui): pick a Slack channel and send a test message#12436pfe-nazaries wants to merge 2 commits into
Conversation
|
Important Review skippedDraft detected. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Offer the connected workspace's channels — public, plus the private ones @Prowler has been invited to — through a props-driven picker the alerts form can import unchanged, record the choice as the integration's default (only channel_id travels; the API derives the name), and prove delivery with a test message that polls the task the API hands back.
Read the refusal's `code` on every Slack-backed flow, not only on the OAuth ones: the channel listing kept the wait Slack asked for nowhere, the channel save reported the two channel refusals as one sentence, and the test message showed Slack's raw reason as if it were copy. - Keep `Retry-After` on a rate-limited channel listing, so the user is told when to come back instead of only that it failed - Record the destination through a Slack action, so "the channel is gone" and "invite @Prowler to it" stop collapsing into one message - Map the reason the test-message task settles with, falling back to the API's own wording when it is not one Prowler has copy for - Give the MSW refusals the API's real body shape, code and all
a9a340d to
7778199
Compare
|
✅ All required changelog fragments are present. |
|
✅ No Conflicts No conflict markers, and the branch merges cleanly into its base. |
|
|
||
| try { | ||
| for (let page = 0; next && page < MAX_CHANNEL_PAGES; page += 1) { | ||
| const response: Response = await fetch(next, { method: "GET", headers }); |
| const response = await fetch(url.toString(), { | ||
| method: "PATCH", | ||
| headers, | ||
| body: JSON.stringify({ | ||
| data: { | ||
| type: "integrations", | ||
| id: integrationId, | ||
| attributes: { | ||
| integration_type: "slack", | ||
| configuration: { channel_id: channelId }, | ||
| }, | ||
| }, | ||
| }), | ||
| }); |
| ); | ||
|
|
||
| try { | ||
| const response = await fetch(url.toString(), { method: "POST", headers }); |
🔒 Container Security ScanImage: ✅ No Vulnerabilities DetectedThe container image passed all security checks. No known CVEs were found.📋 Resources:
|
🔎 Container Security Scan (Grype)Image: ✅ Nothing BlockingNo findings at critical or high severity. 📋 Resources:
|
Context
PR 2 of 4 in the Slack integration stack. Based on #12435 (connect a workspace) — review that one first; this PR's diff is only the channel and test-message layer.
Once a workspace is connected, the tenant needs somewhere for Prowler to post, and a way to prove the delivery path actually works before anything is built on top of it.
Scope: UI only. The Slack API lives in a separate private repository, implemented by the backend lane against the shared contract.
Description
slack-channel-selector.tsx) — a self-contained, props-driven component: options carryingis_private, value, onChange, empty and error states. It knows nothing about the management page and nothing about server actions. This is deliberate: the alert-rule form will import it unchanged rather than needing a rewrite, so welding it into the manager was the thing to avoid.links.nextcursor pagination until exhausted — Slack'sconversations.listis rate-limited and paginated, and the fixtures exercise the aggregation across two pages.channel_id; the API validates it against Slack and deriveschannel_nameserver-side, so a channel cannot be recorded blind and the stored name cannot drift from the id.Steps to review
slack-channel-selector.tsxfirst and check its import list — if it ever reaches for a server action or manager state, the seam it exists for is gone.slack-page.integration.test.tsxat this layer (8 inherited, 8 added) plus 2 in the catalogue file.Checklist
Community Checklist
<component>/changelog.d/.UI
ui/changelog.d/API
Not applicable — no API change in this PR, by design.
License
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.