Skip to content

fix(integrations): fix Slack integration modal after redirect - #8542

Open
bakirFS wants to merge 2 commits into
mainfrom
fix/slack-org-integration
Open

bakirFS wants to merge 2 commits into
mainfrom
fix/slack-org-integration

Conversation

@bakirFS

@bakirFS bakirFS commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Thanks for submitting a PR! Please check the boxes below:

  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Closes #8359

Fixed the modal showing the project picker instead of channel picker after Slack redirect.

How did you test this code?

Tested it manually, and disable changing the project after the Slack redirect since you can only connect to projects you approved.

@bakirFS
bakirFS requested a review from a team as a code owner September 16, 2026 13:50
@bakirFS
bakirFS requested review from talissoncosta and removed request for a team September 16, 2026 13:50
@vercel

vercel Bot commented Sep 16, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated
docs Ignored Ignored Sep 16, 2026 1:50pm UTC
flagsmith-frontend-preview Ignored Ignored Sep 16, 2026 1:50pm UTC
flagsmith-frontend-staging Ignored Ignored Sep 16, 2026 1:50pm UTC

Request Review

@coderabbitai

coderabbitai Bot commented Sep 16, 2026

Copy link
Copy Markdown

Review Change StackReview Change Stack

📝 Walkthrough

Walkthrough

IntegrationList now validates the configure URL parameter against available integrations and passes the URL project parameter to CreateEditIntegration. The OAuth return URL includes the project when present. The project selector becomes read-only after authorisation. The environment selector becomes read-only only for existing integrations.

Priority: ➖ Normal

Estimated code review effort: 2 (Simple) | ~10 minutes

Severity of issue fixed: Medium

Merge Risk: 🟡 Moderate · up to c054d

Users can submit a Slack channel from the wrong environment, so the environment should be locked or channel state refreshed before merge.


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.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added front-end Issue related to the React Front End Dashboard fix labels Sep 16, 2026
@github-actions

github-actions Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-api-test:pr-8542 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-e2e:pr-8542 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api:pr-8542 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-8542 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-8542 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-frontend:pr-8542 Finished ✅ Results

@github-actions

github-actions Bot commented Sep 16, 2026

Copy link
Copy Markdown
Contributor
✅ private-cloud · depot-ubuntu-latest-arm-16 — run #20489 (attempt 2)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  3 passed

Details

stats  3 tests across 3 suites
duration  35.6 seconds
commit  c054d08
info  🔄 Run: #20489 (attempt 2)

🗂️ Previous results
❌ private-cloud · depot-ubuntu-latest-arm-16 — run #20489 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

failed  1 failed
passed  1 passed

Details

stats  2 tests across 2 suites
duration  1 minute, 20 seconds
commit  c054d08
info  📦 Artifacts: View test results and HTML report
🔄 Run: #20489 (attempt 1)

Failed tests

firefox › tests/environment-permission-test.pw.ts › Environment Permission Tests › Environment-level permissions control access to features, identities, and segments @enterprise

✅ private-cloud · depot-ubuntu-latest-16 — run #20489 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  36.2 seconds
commit  c054d08
info  🔄 Run: #20489 (attempt 1)

✅ oss · depot-ubuntu-latest-16 — run #20489 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  34.5 seconds
commit  c054d08
info  🔄 Run: #20489 (attempt 1)

✅ oss · depot-ubuntu-latest-arm-16 — run #20489 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  2 passed

Details

stats  2 tests across 2 suites
duration  36.5 seconds
commit  c054d08
info  🔄 Run: #20489 (attempt 1)

@github-actions

Copy link
Copy Markdown
Contributor

Visual Regression

19 screenshots compared. See report for details.
View full report

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Advanced

Run ID: 79e64a3d-35c0-4de5-a3a0-b71c0ba0d26e

📥 Commits

Reviewing files that changed from the base of the PR and between 7efa778 and c054d08.

📒 Files selected for processing (2)
  • frontend/web/components/IntegrationList.tsx
  • frontend/web/components/modals/CreateEditIntegrationModal.tsx

Included review availability: Your plan provides up to 8 included reviews per hour; 7 remain after this review.

<EnvironmentSelect
projectId={projectId}
readOnly={!!data}
readOnly={!!data?.id}

@coderabbitai coderabbitai Bot Sep 16, 2026

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🗄️ Data Integrity & Integration | 🟠 Major | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

sed -n '180,330p' frontend/web/components/modals/CreateEditIntegrationModal.tsx
sed -n '430,540p' frontend/web/components/modals/CreateEditIntegrationModal.tsx
rg -n 'authorised|flagsmithEnvironment|channel|EnvironmentSelect|handleOauthSignature|useEffect|onSubmit' frontend/web/components/modals/CreateEditIntegrationModal.tsx frontend/web/components/IntegrationList.tsx

Repository: Flagsmith/flagsmith

Length of output: 14281


🏁 Script executed:

sed -n '1,220p' frontend/web/components/modals/CreateEditIntegrationModal.tsx
rg -n -C 8 'CreateEditIntegrationModal|configure|environment|data=' frontend/web --glob '*.tsx' --glob '*.ts' | head -n 240

Repository: Flagsmith/flagsmith

Length of output: 26517


🏁 Script executed:

rg -n -C 12 'configure|CreateEditIntegration' frontend/web --glob '*.tsx' --glob '*.ts' | rg -B 12 -A 12 'configure|CreateEditIntegration' | head -n 260

Repository: Flagsmith/flagsmith

Length of output: 21855


Keep the environment fixed after Slack authorisation.

IntegrationList.addIntegration passes only { flagsmithEnvironment: params.environment } on the OAuth return, so data?.id is absent. The mount-only Slack effect fetches channels for that environment and then sets authorised, but EnvironmentSelect does not use that state.

The form can therefore submit the current environment with a channel_id from the original environment. Use readOnly={authorised || !!data?.id}, or refetch the channels and clear the selected channel when the environment changes.

Proposed fix
-              readOnly={!!data?.id}
+              readOnly={authorised || !!data?.id}
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
readOnly={!!data?.id}
readOnly={authorised || !!data?.id}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

data comes from two callers: addIntegration (the OAuth return) passes no id, editIntegration passes the saved record, which has one. !!data?.id is what tells them apart, it is editable when it comes back from OAuth, and not when editing an existing integration.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bakirFS, agreed. !!data?.id correctly distinguishes the OAuth-return flow from the existing-integration edit flow. The proposed read-only change would prevent the required OAuth-return behavior.

The concern is limited to a later environment change in the OAuth-return flow. After authorised is set, the Slack channel list remains from the original environment. If the environment must remain editable, the environment change handler should clear channel_id and refetch channels for the new environment.


✏️ Learnings added
Learnt from: bakirFS
Repo: Flagsmith/flagsmith PR: 8542
File: frontend/web/components/modals/CreateEditIntegrationModal.tsx:502-502
Timestamp: 2026-09-16T14:45:08.308Z
Learning: In `frontend/web/components/modals/CreateEditIntegrationModal.tsx`, `data?.id` distinguishes the Slack OAuth-return flow from editing an existing integration. `addIntegration` passes OAuth-return data without an `id`, so the environment remains editable. `editIntegration` passes the saved integration record with an `id`, so the environment is read-only.

Note: Learnings are effective only in the context of similar code segments. To apply general coding guidelines, please configure review instructions. You can manage existing learnings in the app.

You are interacting with an AI system.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fix front-end Issue related to the React Front End Dashboard

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Slack integration via Organization Integrations goes into an infinite loop

2 participants