From 4fc8ba82e62e257880ec86a7b16b7786e1ee29cf Mon Sep 17 00:00:00 2001 From: Tom Hughes Date: Sun, 4 Oct 2026 19:44:06 +0100 Subject: [PATCH] Fix N+1 queries in user blocks controller --- app/controllers/user_blocks_controller.rb | 2 +- test/prosopite_todo.yml | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/app/controllers/user_blocks_controller.rb b/app/controllers/user_blocks_controller.rb index 457982352..59ca4355d 100644 --- a/app/controllers/user_blocks_controller.rb +++ b/app/controllers/user_blocks_controller.rb @@ -110,7 +110,7 @@ class UserBlocksController < ApplicationController ## # ensure that there is a "user_block" instance variable def lookup_user_block - @user_block = UserBlock.find(params.expect(:id)) + @user_block = UserBlock.preload(:user, :creator, :revoker).find(params.expect(:id)) rescue ActiveRecord::RecordNotFound render :action => "not_found", :status => :not_found end diff --git a/test/prosopite_todo.yml b/test/prosopite_todo.yml index 5813c84c6..36ac8b48e 100644 --- a/test/prosopite_todo.yml +++ b/test/prosopite_todo.yml @@ -5,7 +5,6 @@ # `includes` or `preload`. Remove files from the list once they are fixed. - app/controllers/issues_controller.rb -- app/controllers/user_blocks_controller.rb - app/helpers/user_helper.rb - app/models/node.rb - app/models/old_node.rb -- 2.47.3