Conversation
|
I see you added the "On Staging" label, I'll get this merged to the staging branch! |
Patch-level lockfile bumps for concurrent-ruby, crass, faraday, json, loofah, msgpack, net-imap, nokogiri, rails-html-sanitizer, and websocket-driver. New advisories published 2026-07-17 fail the CI lint job on any branch, including master. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Merge conflict attempting to merge this into staging. Please fix manually. |
brakeman --ensure-latest fails CI now that 8.0.5 is out; the update also surfaces a new Rails 7.2 EOL warning (2026-08-09), recorded in config/brakeman.ignore the same way the previous Rails 7.1 EOL warning was, replacing that now-obsolete entry. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Merge conflict attempting to merge this into staging. Please fix manually. |
Group pages reorder route with the other pages routes Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Allow updating page position directly via pages#update Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Merge conflict attempting to merge this into staging. Please fix manually. |
| resources :drafts, only: [:index, :show, :create, :destroy] | ||
| resources :translations, only: [:index, :show] | ||
| resources :pages, only: [:create, :update, :show] | ||
| post "resources/:resource_id/pages/reorder", to: "pages#reorder" |
There was a problem hiding this comment.
I forgot that the normal pages endpoint wasn't nested under resources like it should have been :(
Renaming or repositioning an existing page ran UsesCrowdinValidator and 400'd for any resource without a crowdin_project_id, even though page saves never push to Crowdin. Scope the validator to creation so existing pages stay editable while page creation on non-Crowdin resources stays blocked. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
90eaa52 scopes Note this also unblocks structure edits on non-Crowdin resources (previously blocked by the same validation) — @frett flagging in case that block was intentional. 🤖 Generated with Claude Code |
| validates :position, presence: true, uniqueness: {scope: :resource} | ||
| validates :resource, presence: true | ||
| validates_with UsesCrowdinValidator | ||
| validates_with UsesCrowdinValidator, on: :create |
There was a problem hiding this comment.
I wonder if we even need this validator still?
the API used to upload phrases to OneSky (pre-Crowdin) to provide the new phrases for translators. This process was buggy and ended up paving over quite a few translations so we disabled it ~10 years ago and removed the upload entirely a couple years ago. I'm not sure what the UsesCrowdinValidator actually is doing for the Page model, but it might be unnecessary code
Summary
PagesController#updatenow permitsfilename(alongsidestructure), so the admin tool can rename a page without direct database access. Duplicate filenames are rejected by the existing model validation (400).POST /resources/:resource_id/pages/reorderendpoint takes the complete ordered list of page ids and atomically renumbers positions 0..n-1 in a transaction. The id set must exactly match the resource's pages (else 400). A two-pass update (park at negative positions, then assign final order) avoids collisions with the(position, resource_id)unique index; validation happens inside the transaction with a row lock.PageSerializernow serializesposition, so clients can sort pages without relying on the API's default ordering.Supports the admin-side UI in the companion mobile-content-admin PR (drag-and-drop reorder + inline rename), which depends on this change.
Test Plan
spec/acceptance/pages_controller_spec.rb— 15 examples, 0 failures)standardrbclean🤖 Generated with Claude Code