Skip to content

Consolidate user settings update protocol - #1652

Open
skyfallwastaken wants to merge 1 commit into
mainfrom
amp/consolidate-settings-update-protocol
Open

skyfallwastaken wants to merge 1 commit into
mainfrom
amp/consolidate-settings-update-protocol

Conversation

@skyfallwastaken

Copy link
Copy Markdown
Member

Summary of the problem

Several simple settings controllers repeat the same user update, success notice, redirect and validation response protocol. This makes the stable response behaviour harder to keep consistent.

Describe your changes

Adds a narrow helper to Settings::BaseController for updates, direct or referrer based redirects, common notices and validation re renders. Appearance, Editors, Privacy and Profile now use it. Appearance still clears Inertia history.

The Slack and GitHub action stays custom to preserve its current synchronous Slack status side effect. Goals and notifications are unchanged.

Screenshots / Media

Not applicable. There are no visual changes.

Copilot AI lite review requested due to automatic review settings September 1, 2026 02:32

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

This PR consolidates the repeated “update current user settings + redirect/notice + validation re-render” protocol into a single helper on Settings::BaseController, then updates several settings controllers to use it to keep response behaviour consistent.

Changes:

  • Added update_user_settings to Settings::BaseController to centralise update + redirect/back behaviour, notices, Inertia clear_history support, and validation rendering.
  • Refactored Appearance, Editors, Privacy and Profile settings controllers to use the shared helper (keeping Appearance’s Inertia history clearing).
  • Updated and added controller tests to assert redirect destinations (including referrer-based redirects), persisted settings, and flash notices/errors.

Reviewed changes

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

Show a summary per file
File Description
app/controllers/settings/base_controller.rb Introduces update_user_settings helper for consistent settings update/redirect/error handling.
app/controllers/settings/appearance_controller.rb Switches theme update to use the shared helper while preserving clear_history.
app/controllers/settings/editors_controller.rb Switches editors update to use the shared helper with direct redirect.
app/controllers/settings/privacy_controller.rb Switches privacy update to use the shared helper with referrer-based redirect.
app/controllers/settings/profile_controller.rb Switches profile section updates to use the shared helper with referrer-based redirect.
test/controllers/settings_appearance_controller_test.rb Asserts flash notice is set on successful theme update (and keeps existing Inertia assertions).
test/controllers/settings_editors_controller_test.rb Adds coverage for editors update persistence, redirect behaviour and success notice.
test/controllers/settings_profile_controller_test.rb Updates redirect expectations to follow referrer, and strengthens invalid update assertions for flash error and persistence.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@greptile-apps

greptile-apps Bot commented Sep 1, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Consolidates repeated user-settings update behavior into a private Settings::BaseController helper while preserving controller-specific redirects and Inertia history clearing.

  • Migrates appearance, editors, privacy, and profile updates to the shared protocol.
  • Adds and strengthens controller tests for persistence, redirects, notices, and validation failures.

Confidence Score: 5/5

The PR appears safe to merge because the consolidated helper preserves the response behavior of every migrated settings action.

Each migrated controller supplies the redirect mode and fallback used by its previous implementation, appearance retains Inertia history clearing, and validation failures retain the same flash and unprocessable-entity rendering path.

Important Files Changed

Filename Overview
app/controllers/settings/base_controller.rb Adds a narrow helper that preserves the former update, notice, redirect, and validation-rendering protocol.
app/controllers/settings/appearance_controller.rb Delegates theme updates while retaining referrer fallback and Inertia history clearing.
app/controllers/settings/editors_controller.rb Delegates editor updates while retaining the direct editors-page redirect.
app/controllers/settings/privacy_controller.rb Delegates privacy updates while preserving redirect-back behavior and fallback location.
app/controllers/settings/profile_controller.rb Delegates profile section updates while preserving referrer-based redirects and validation handling.
test/controllers/settings_appearance_controller_test.rb Extends the appearance update test to verify the shared success notice.
test/controllers/settings_editors_controller_test.rb Adds coverage for editor-setting persistence, direct redirect behavior, and the success notice.
test/controllers/settings_profile_controller_test.rb Strengthens coverage for referrer redirects, notices, and failed-update persistence behavior.

Reviews (1): Last reviewed commit: "Consolidate settings update protocol" | Re-trigger Greptile

This branch has not been deployed

No deployments
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.

2 participants