Actions
Feature #42589
closedOptimize watchers list rendering by eager loading email addresses
Start date:
Due date:
% Done:
0%
Estimated time:
Resolution:
Fixed
Description
When the "Use Gravatar user icons" setting is enabled, viewing an issue causes one query per watcher to load their email address. This patch reduces the number of database queries by eager loading email_address for the watcher users.
Files
Updated by Go MAEDA about 1 month ago
- Target version changed from Candidate for next major release to 5.1.8
Setting the target version to 5.1.8.
Updated by Go MAEDA about 1 month ago
- Target version deleted (
5.1.8)
The patch causes an error when the watcher list contains a group.
ActionView::Template::Error (Association named 'email_address' was not found on Group; perhaps you misspelled it?): Causes: ActiveRecord::AssociationNotFoundError (Association named 'email_address' was not found on Group; perhaps you misspelled it?) 11: <% if User.current.allowed_to?(:"view_#{watched_klass_name}_watchers", watched.project) %> 12: <h3><%= l(:"label_#{watched_klass_name}_watchers") %> (<%= watched.watcher_users.size %>)</h3> 13: 14: <%= watchers_list(watched) %> 15: <% else %> 16: <h3><%= l(:"label_#{watched_klass_name}_watchers") %></h3> 17: <% end %> app/helpers/watchers_helper.rb:53:in 'Enumerable#collect' app/helpers/watchers_helper.rb:53:in 'WatchersHelper#watchers_list' app/views/watchers/_watchers.html.erb:14 app/views/issues/show.html.erb:147 app/views/issues/show.html.erb:141 app/controllers/issues_controller.rb:125:in 'block (2 levels) in IssuesController#show' app/controllers/issues_controller.rb:112:in 'IssuesController#show' lib/redmine/sudo_mode.rb:78:in 'Redmine::SudoMode::Controller#sudo_mode'
Updated by Go MAEDA 29 days ago
- File optimize-watchers_list-v2.patch optimize-watchers_list-v2.patch added
- Target version set to Candidate for next major release
I have updated the patch to fix the error. The group now also has an 'email_address' association, which always returns nil.
Actions