[WEB-4900] refactor: remove base_host retrieval from authentication views#7804
[WEB-4900] refactor: remove base_host retrieval from authentication views#7804sriramveeraghanta merged 2 commits intopreviewfrom
Conversation
* Removed unnecessary base_host retrieval from GitHub, GitLab, and Google callback endpoints. * Updated MagicSignUpEndpoint to use get_safe_redirect_url for URL construction. * Refactored MagicSignInSpaceEndpoint to streamline URL redirection logic.
|
Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. WalkthroughRemoves local variables that shadow the base_host helper in GitHub/GitLab/Google app OAuth callbacks, adjusts magic sign-in/sign-up redirect construction to use get_safe_redirect_url with params, and updates get_safe_redirect_url to accept an optional params argument. Imports for manual URL assembly are removed where no longer needed. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
participant C as Client (App)
participant S as MagicSignInSpaceEndpoint
participant U as get_safe_redirect_url
Note over S: Sign-in attempt (space)
C->>S: POST /magic/signin
alt Success
S->>U: Build redirect (base_url, next_path, params=None)
U-->>S: Safe URL
S-->>C: 302 Redirect to next_path
else Error/Exception
S->>U: Build redirect (base_url, next_path, params=error)
U-->>S: Safe URL with query params
S-->>C: 302 Redirect with error params
end
Note over U: New params argument used
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
Pre-merge checks and finishing touches❌ Failed checks (1 warning)
✅ Passed checks (2 passed)
✨ Finishing touches
🧪 Generate unit tests
📜 Recent review detailsConfiguration used: CodeRabbit UI Review profile: CHILL Plan: Pro 📒 Files selected for processing (5)
💤 Files with no reviewable changes (4)
🧰 Additional context used🧬 Code graph analysis (1)apps/api/plane/authentication/views/space/magic.py (1)
🔇 Additional comments (2)
Tip 👮 Agentic pre-merge checks are now available in preview!Pro plan users can now enable pre-merge checks in their settings to enforce checklists before merging PRs.
Please see the documentation for more information. Example: reviews:
pre_merge_checks:
custom_checks:
- name: "Undocumented Breaking Changes"
mode: "warning"
instructions: |
Pass/fail criteria: All breaking changes to public APIs, CLI flags, environment variables, configuration keys, database schemas, or HTTP/GraphQL endpoints must be documented in the "Breaking Change" section of the PR description and in CHANGELOG.md. Exclude purely internal or private changes (e.g., code not exported from package entry points or explicitly marked as internal).Please share your feedback with us on this Discord post. 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 |
|
Pull Request Linked with Plane Work Items Comment Automatically Generated by Plane |
There was a problem hiding this comment.
Pull Request Overview
This PR refactors authentication callback endpoints to remove unnecessary base_host retrievals and standardizes URL redirection logic. The changes focus on cleaning up code by eliminating unused variables and consolidating URL construction methods.
- Removed unused base_host variable retrieval from GitHub, GitLab, and Google OAuth callback endpoints
- Updated MagicSignUpEndpoint to use get_safe_redirect_url instead of manual URL construction with urljoin
- Cleaned up redundant parameter handling in magic authentication
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 1 comment.
Show a summary per file
| File | Description |
|---|---|
| apps/api/plane/authentication/views/app/github.py | Removed unused base_host variable from callback endpoint |
| apps/api/plane/authentication/views/app/gitlab.py | Removed unused base_host variable from callback endpoint |
| apps/api/plane/authentication/views/app/google.py | Removed unused base_host variable from callback endpoint |
| apps/api/plane/authentication/views/app/magic.py | Removed redundant next_path parameter assignment |
| apps/api/plane/authentication/views/space/magic.py | Replaced manual URL construction with get_safe_redirect_url and removed unused imports |
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
* Removed redundant base_url retrieval from the exception handling in MagicSignInSpaceEndpoint. * Enhanced the clarity of URL construction by directly using get_safe_redirect_url.
…iews (makeplane#7804) * refactor: remove base_host retrieval from authentication views * Removed unnecessary base_host retrieval from GitHub, GitLab, and Google callback endpoints. * Updated MagicSignUpEndpoint to use get_safe_redirect_url for URL construction. * Refactored MagicSignInSpaceEndpoint to streamline URL redirection logic. * refactor: streamline URL redirection in MagicSignInSpaceEndpoint * Removed redundant base_url retrieval from the exception handling in MagicSignInSpaceEndpoint. * Enhanced the clarity of URL construction by directly using get_safe_redirect_url.
Description
Type of Change
Test Scenarios
References
WEB-4900
Summary by CodeRabbit