]> git.openstreetmap.org Git - rails.git/commit
Fix N+1 queries for comment authors in the notes API
authorAndy Allan <git@gravitystorm.co.uk>
Thu, 1 Oct 2026 12:40:54 +0000 (13:40 +0100)
committerAndy Allan <git@gravitystorm.co.uk>
Thu, 1 Oct 2026 17:51:35 +0000 (18:51 +0100)
commit39047c16679609db31498b57952145e73d020d43
tree8dd70cdc76661e44e4615f0089e8501a4fe48952
parent566f2225c4a556fe6430059fd895170b11a2f64d
Fix N+1 queries for comment authors in the notes API

Preload the authors of note comments, and of the notes themselves for
the RSS feeds, when rendering notes from the API.

The tests now use notes with comments by at least three different
users, as prosopite doesn't always detect an N+1 query with only two
records - the first query in a process can have a different call stack
while the association's statement cache is built.
app/controllers/api/notes_controller.rb
test/controllers/api/notes_controller_test.rb
test/factories/notes.rb
test/prosopite_todo.yml