Skip to content

OTWO-7576 Preserve dark mode settings per user#1894

Merged
Niharika1117 merged 4 commits into
OTWO-7546from
OTWO-7576
May 13, 2026
Merged

OTWO-7576 Preserve dark mode settings per user#1894
Niharika1117 merged 4 commits into
OTWO-7546from
OTWO-7576

Conversation

@Niharika1117
Copy link
Copy Markdown
Contributor

No description provided.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds server-backed (per-account) theme preference support so “dark mode” can persist across sessions/devices, and updates the frontend theme toggle to use cookies + a small JSON API instead of only localStorage.

Changes:

  • Added Account#theme_preference and Account#theme_preference= backed by Setting records keyed by account id.
  • Introduced GET /accounts/:id/theme_preference.json and POST /accounts/:id/set_theme_preference endpoints plus JS fetch-based syncing.
  • Updated layout/theme JS to apply theme early (cookie + prefers-color-scheme) and removed debug logging from mobile menu JS.

Reviewed changes

Copilot reviewed 11 out of 11 changed files in this pull request and generated 8 comments.

Show a summary per file
File Description
app/models/account.rb Adds per-account theme preference getter/setter backed by Setting.
app/controllers/accounts_controller.rb Adds JSON endpoints to read/update theme preference.
config/routes.rb Adds member routes for theme preference endpoints.
app/views/layouts/application.html.haml Adds early theme application script and emits a current-user meta tag for client-side detection.
app/assets/javascripts/theme_toggle.js Switches theme persistence to cookie + server sync for authenticated users.
app/assets/javascripts/mobile_menu.js Removes console logging from mobile menu toggle script.
app/controllers/sessions_controller.rb Bypasses reCAPTCHA in development for login flow.
test/models/setting_test.rb Adds tests around storing/retrieving theme settings via Setting.
test/models/account_test.rb Adds tests for Account#theme_preference behavior and sparse storage semantics.
test/controllers/accounts_controller_test.rb Adds controller tests for the new endpoints.
test/integration/theme_preference_test.rb Adds integration coverage for theme preference API behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread app/views/layouts/application.html.haml Outdated
Comment thread app/controllers/accounts_controller.rb
Comment thread app/controllers/accounts_controller.rb Outdated
Comment thread app/controllers/accounts_controller.rb Outdated
Comment thread app/assets/javascripts/theme_toggle.js Outdated
Comment thread app/controllers/sessions_controller.rb
Comment thread test/integration/theme_preference_test.rb Outdated
Comment thread test/controllers/accounts_controller_test.rb Outdated
@Niharika1117 Niharika1117 added the Don't merge No CI tasks will run label May 11, 2026
@Niharika1117 Niharika1117 merged commit 0c95b2e into OTWO-7546 May 13, 2026
1 check passed
@Niharika1117 Niharika1117 deleted the OTWO-7576 branch May 13, 2026 06:03
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Don't merge No CI tasks will run

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants