-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
feat: security settings persistence #2002
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: staging
Are you sure you want to change the base?
Conversation
|
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. Important Review skippedAuto incremental reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the WalkthroughAdds TRPC-backed fetch and save of security settings to the Mail app’s Security page with React Query, optimistic updates, loading/disabled states, and toasts. Server schema gains two boolean fields (twoFactorAuth, loginNotifications) and corresponding defaults in user settings. Changes
Sequence Diagram(s)sequenceDiagram
autonumber
actor U as User
participant P as SecurityPage (React)
participant Q as React Query Cache
participant T as TRPC Server
participant D as DB
rect rgba(200,230,255,0.3)
U->>P: Navigate to Security Settings
P->>T: getUserSettings()
T->>D: Read settings
D-->>T: Settings
T-->>P: Settings
P->>Q: cache set (settings)
P-->>U: Render form (disabled while loading)
end
rect rgba(200,255,200,0.3)
U->>P: Submit changes
P->>Q: Optimistic update (save snapshot)
P->>T: updateUserSettings(changes)
T->>D: Persist changes
D-->>T: OK
T-->>P: Success
P-->>U: Show success toast
end
rect rgba(255,220,220,0.4)
note over P,T: Error path
T-->>P: Error
P->>Q: Rollback to snapshot
P-->>U: Show failure toast
end
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Possibly related PRs
Suggested labels
Suggested reviewers
Poem
✨ Finishing Touches🧪 Generate unit tests
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. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. CodeRabbit Commands (Invoked using PR/Issue comments)Type Other keywords and placeholders
CodeRabbit Configuration File (
|
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.
1 issue found across 2 files
React with 👍 or 👎 to teach cubic. You can also tag @cubic-dev-ai to give feedback, ask questions, or re-run the review.
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.
Actionable comments posted: 12
📜 Review details
Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro
💡 Knowledge Base configuration:
- MCP integration is disabled by default for public repositories
- Jira integration is disabled by default for public repositories
- Linear integration is disabled by default for public repositories
You can enable these sources in your CodeRabbit configuration.
📒 Files selected for processing (2)
apps/mail/app/(routes)/settings/security/page.tsx(7 hunks)apps/server/src/lib/schemas.ts(2 hunks)
🧰 Additional context used
📓 Path-based instructions (4)
**/*.{css,js,ts,jsx,tsx,mdx}
📄 CodeRabbit inference engine (.cursor/rules/tailwind-css-v4.mdc)
**/*.{css,js,ts,jsx,tsx,mdx}: Chain variants together for composable variants (e.g.,group-has-data-potato:opacity-100).
Use new variants such asstarting,not-*,inert,nth-*,in-*,open(for:popover-open), and**for all descendants.
Do not use deprecated utilities likebg-opacity-*,text-opacity-*,border-opacity-*, anddivide-opacity-*; use the new syntax (e.g.,bg-black/50).
Use renamed utilities:shadow-smis nowshadow-xs,shadowis nowshadow-sm,drop-shadow-smis nowdrop-shadow-xs,drop-shadowis nowdrop-shadow-sm,blur-smis nowblur-xs,bluris nowblur-sm,rounded-smis nowrounded-xs,roundedis nowrounded-sm,outline-noneis nowoutline-hidden.
Usebg-(--brand-color)syntax for CSS variables in arbitrary values instead ofbg-[--brand-color].
Stacked variants now apply left-to-right instead of right-to-left.
Files:
apps/mail/app/(routes)/settings/security/page.tsxapps/server/src/lib/schemas.ts
**/*.{js,jsx,ts,tsx}
📄 CodeRabbit inference engine (AGENT.md)
**/*.{js,jsx,ts,tsx}: Use 2-space indentation
Use single quotes
Limit lines to 100 characters
Semicolons are required
Files:
apps/mail/app/(routes)/settings/security/page.tsxapps/server/src/lib/schemas.ts
**/*.{js,jsx,ts,tsx,css}
📄 CodeRabbit inference engine (AGENT.md)
Use Prettier with sort-imports and Tailwind plugins
Files:
apps/mail/app/(routes)/settings/security/page.tsxapps/server/src/lib/schemas.ts
**/*.{ts,tsx}
📄 CodeRabbit inference engine (AGENT.md)
Enable TypeScript strict mode
Files:
apps/mail/app/(routes)/settings/security/page.tsxapps/server/src/lib/schemas.ts
⏰ 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). (1)
- GitHub Check: cubic · AI code reviewer
|
hey @suraj719 could you please check the coderabbit comments, some are important for state and can you please resolve merge conflicts? |
|
please close/resolve comments from coderabbit once you have resolved them |
yeah sure, i am working on those suggestions. |
please review and let me know if u want me to do any changes 🚀 |
|
make sure you run |
Thanks for catching that, and sorry I missed it earlier :) |
|
heyy @ahmetskilinc , Could you please take a look when you get a chance? Thanks! |
Description
Implemented persistent storage for security settings in the user settings page. Previously, the security settings page had a TODO comment and used a fake
setTimeoutthat only logged values to console without actually saving to the database. This PR adds real database integration for the security settings, making them consistent with other settings pages in the application.Type of Change
Please delete options that are not relevant.
Areas Affected
Please check all that apply:
Testing Done
Describe the tests you've done:
Security Considerations
For changes involving data or authentication:
Checklist
Additional Notes
This implementation follows the same patterns used in other settings pages (appearance, general, privacy) to maintain consistency across the codebase. The security settings now properly persist user preferences and provide real-time feedback during save operations.
By submitting this pull request, I confirm that my contribution is made under the terms of the project's license.
Summary by cubic
Persist security settings to the database and load them on page open. Replaces the fake save with TRPC + React Query, with optimistic updates and error handling.
Summary by CodeRabbit