-
Notifications
You must be signed in to change notification settings - Fork 568
fix(integrations): fix Slack integration modal after redirect #8542
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -239,8 +239,11 @@ const CreateEditIntegration: FC<CreateEditIntegrationProps> = (props) => { | |||||
| const handleOauthSignature = (res: { signature: string } | null) => { | ||||||
| const signature = res && res.signature | ||||||
| if (signature) { | ||||||
| const returnUrl = `${document.location.href}?environment=${ | ||||||
| formData.flagsmithEnvironment | ||||||
| }&configure=${id}${projectId ? `&project=${projectId}` : ''}` | ||||||
| const postfix = `?redirect_url=${encodeURIComponent( | ||||||
| `${document.location.href}?environment=${formData.flagsmithEnvironment}&configure=${id}`, | ||||||
| returnUrl, | ||||||
| )}&signature=${signature}` | ||||||
| document.location = `${constructBaseUrl({ | ||||||
| environmentApiKey: formData.flagsmithEnvironment, | ||||||
|
|
@@ -483,6 +486,7 @@ const CreateEditIntegration: FC<CreateEditIntegrationProps> = (props) => { | |||||
| </label> | ||||||
| <ProjectSelect | ||||||
| organisationId={AccountStore.getOrganisation()?.id} | ||||||
| readOnly={authorised} | ||||||
| value={selectedProjectId} | ||||||
| onChange={(v) => setSelectedProjectId(v)} | ||||||
| /> | ||||||
|
|
@@ -495,7 +499,7 @@ const CreateEditIntegration: FC<CreateEditIntegrationProps> = (props) => { | |||||
| </label> | ||||||
| <EnvironmentSelect | ||||||
| projectId={projectId} | ||||||
| readOnly={!!data} | ||||||
| readOnly={!!data?.id} | ||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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.tsxRepository: 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 240Repository: 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 260Repository: Flagsmith/flagsmith Length of output: 21855 Keep the environment fixed after Slack authorisation.
The form can therefore submit the current environment with a Proposed fix- readOnly={!!data?.id}
+ readOnly={authorised || !!data?.id}📝 Committable suggestion
Suggested change
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
The concern is limited to a later environment change in the OAuth-return flow. After ✏️ Learnings added
You are interacting with an AI system. |
||||||
| value={formData.flagsmithEnvironment} | ||||||
| onChange={(environment) => | ||||||
| update('flagsmithEnvironment', environment) | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think we need this, it might also add a little flicker and bring in discrepancy with the condition from the below environment select