From 0a8fe4e552ab071d62b5c13eb4ce765ef3d330ab Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Sun, 10 Jul 2016 11:14:18 +0000 Subject: [PATCH] Preload email addresses for displaying avatars. git-svn-id: http://svn.redmine.org/redmine/trunk@15624 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/controllers/issues_controller.rb | 7 ++++--- app/helpers/watchers_helper.rb | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index b842023a7..27bb4abf2 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -93,9 +93,10 @@ class IssuesController < ApplicationController end def show - @journals = @issue.journals.includes(:user, :details). - references(:user, :details). - reorder(:created_on, :id).to_a + @journals = @issue.journals. + preload(:details). + preload(:user => :email_address). + reorder(:created_on, :id).to_a @journals.each_with_index {|j,i| j.indice = i+1} @journals.reject!(&:private_notes?) unless User.current.allowed_to?(:view_private_notes, @issue.project) Journal.preload_journals_details_custom_fields(@journals) diff --git a/app/helpers/watchers_helper.rb b/app/helpers/watchers_helper.rb index 7ed7b8914..b3e23a47f 100644 --- a/app/helpers/watchers_helper.rb +++ b/app/helpers/watchers_helper.rb @@ -47,7 +47,7 @@ module WatchersHelper def watchers_list(object) remove_allowed = User.current.allowed_to?("delete_#{object.class.name.underscore}_watchers".to_sym, object.project) content = ''.html_safe - lis = object.watcher_users.collect do |user| + lis = object.watcher_users.preload(:email_address).collect do |user| s = ''.html_safe s << avatar(user, :size => "16").to_s s << link_to_user(user, :class => 'user') -- 2.39.5