Skip to content

Conversation

@Roffenlund
Copy link
Contributor

Pass a next variable to the django backend's logout view.

Implement helper function to create the logout URL with only domain as parameter.

Refs. TS-2779

@Roffenlund Roffenlund marked this pull request as draft November 21, 2025 14:26
@coderabbitai
Copy link

coderabbitai bot commented Nov 21, 2025

Walkthrough

The PR adds buildLogoutUrl(domain?: string) to apps/cyberstorm-remix/cyberstorm/utils/ThunderstoreAuth.tsx, which reads VITE_AUTH_RETURN_URL from public envs and constructs a logout URL with an encoded next parameter. buildAuthLoginUrl’s parameter type was renamed to LoginProps. Navigation components (apps/cyberstorm-remix/app/commonComponents/Navigation/Navigation.tsx) were updated to use buildLogoutUrl(domain) instead of hard-coded domain/logout/ strings for desktop and mobile logout links.

Pre-merge checks and finishing touches

❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
✅ Passed checks (2 passed)
Check name Status Explanation
Description check ✅ Passed The description clearly relates to the changeset, explaining the core objectives of passing a next variable to logout and implementing the helper function.
Title check ✅ Passed The title clearly summarizes the main change: introducing a logout redirect mechanism with a helper function.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch fix--logout-redirect

Tip

📝 Customizable high-level summaries are now available in beta!

You can now customize how CodeRabbit generates the high-level summary in your pull requests — including its content, structure, tone, and formatting.

  • Provide your own instructions using the high_level_summary_instructions setting.
  • Format the summary however you like (bullet lists, tables, multi-section layouts, contributor stats, etc.).
  • Use high_level_summary_in_walkthrough to move the summary from the description to the walkthrough section.

Example instruction:

"Divide the high-level summary into five sections:

  1. 📝 Description — Summarize the main change in 50–60 words, explaining what was done.
  2. 📓 References — List relevant issues, discussions, documentation, or related PRs.
  3. 📦 Dependencies & Requirements — Mention any new/updated dependencies, environment variable changes, or configuration updates.
  4. 📊 Contributor Summary — Include a Markdown table showing contributions:
    | Contributor | Lines Added | Lines Removed | Files Changed |
  5. ✔️ Additional Notes — Add any extra reviewer context.
    Keep each section concise (under 200 words) and use bullet or numbered lists for clarity."

Note: This feature is currently in beta for Pro-tier users, and pricing will be announced later.


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 and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
apps/cyberstorm-remix/app/commonComponents/Navigation/Navigation.tsx (1)

571-573: Mobile logout uses helper; consider whether domain should be required

Using buildLogoutUrl(domain) for mobile logout gives you the same next behavior and also safely falls back to /logout if domain is undefined, which is an improvement over raw string interpolation. If domain is in practice always provided for this component, consider making domain a required string in the props to make that contract explicit; otherwise the current optional type plus helper fallback is fine.

apps/cyberstorm-remix/cyberstorm/utils/ThunderstoreAuth.tsx (1)

18-23: buildLogoutUrl correctly centralizes logout + next; consider empty-return behavior and tests

The new buildLogoutUrl correctly pulls VITE_AUTH_RETURN_URL, builds the domain‑aware /logout/ URL, and always appends a URL‑encoded next parameter, which matches the PR’s goal. The fallback to /logout when domain is omitted is also a nice safety net for callers. The only open question is what you want to happen when VITE_AUTH_RETURN_URL is missing—right now you’ll get ?next=; if that’s not desirable, you could either omit the next param in that case or default to a sensible origin. It might also be worth adding a small unit test for this helper (with and without domain, env set vs unset) to guard future changes.

📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 03b897a and d04fdb3.

📒 Files selected for processing (2)
  • apps/cyberstorm-remix/app/commonComponents/Navigation/Navigation.tsx (3 hunks)
  • apps/cyberstorm-remix/cyberstorm/utils/ThunderstoreAuth.tsx (1 hunks)
🧰 Additional context used
🧬 Code graph analysis (2)
apps/cyberstorm-remix/cyberstorm/utils/ThunderstoreAuth.tsx (1)
apps/cyberstorm-remix/cyberstorm/security/publicEnvVariables.ts (1)
  • getPublicEnvVariables (19-48)
apps/cyberstorm-remix/app/commonComponents/Navigation/Navigation.tsx (1)
apps/cyberstorm-remix/cyberstorm/utils/ThunderstoreAuth.tsx (1)
  • buildLogoutUrl (18-23)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
  • GitHub Check: Build
  • GitHub Check: Generate visual diffs
🔇 Additional comments (3)
apps/cyberstorm-remix/app/commonComponents/Navigation/Navigation.tsx (2)

38-41: Auth helpers import keeps URL construction DRY

Importing both buildAuthLoginUrl and buildLogoutUrl here is a good move; it centralizes auth URL construction and avoids hard‑coded paths scattered through navigation.


408-412: Desktop logout now correctly uses centralized helper with next

Switching the desktop logout link to href={buildLogoutUrl(domain)} aligns with the new helper and ensures the Django logout view consistently receives the next parameter while preserving the existing domain‑based path.

apps/cyberstorm-remix/cyberstorm/utils/ThunderstoreAuth.tsx (1)

3-16: Login helper type change verified—no legacy references found

The new LoginProps interface is properly scoped to ThunderstoreAuth.tsx with no older Props type exported. All six call sites in Navigation.tsx and one in Connections.tsx continue to work with the updated signature. The type refactor is safe and complete.

@codecov
Copy link

codecov bot commented Nov 21, 2025

Codecov Report

❌ Patch coverage is 0% with 11 lines in your changes missing coverage. Please review.
✅ Project coverage is 9.88%. Comparing base (03b897a) to head (86a84a9).
⚠️ Report is 36 commits behind head on master.

Files with missing lines Patch % Lines
...rstorm-remix/cyberstorm/utils/ThunderstoreAuth.tsx 0.00% 8 Missing ⚠️
...mix/app/commonComponents/Navigation/Navigation.tsx 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff            @@
##           master   #1638      +/-   ##
=========================================
- Coverage    9.89%   9.88%   -0.01%     
=========================================
  Files         310     310              
  Lines       22462   22468       +6     
  Branches      406     406              
=========================================
- Hits         2223    2222       -1     
- Misses      20239   20246       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Implement helper function to build the logout URL. Add a ?next
parameter to the logout URL which returns the user to the Nimbus
index page. This should override the Django logout function to
redirect to Nimbus instead of legacy page index page upon logout.

Refs. TS-2779
Replace the static URL with buildLogoutUrl in the navigation links.

TS-2779
@Roffenlund Roffenlund marked this pull request as ready for review November 27, 2025 10:07
@Roffenlund Roffenlund requested a review from Oksamies November 27, 2025 13:18
@Roffenlund Roffenlund changed the title Update logout redirect (WIP) Update logout redirect Nov 27, 2025
@Roffenlund Roffenlund merged commit 55d7eb7 into master Dec 2, 2025
26 of 29 checks passed
@Roffenlund Roffenlund deleted the fix--logout-redirect branch December 2, 2025 09:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants