]> source.dussan.org Git - redmine.git/commitdiff
Preload email addresses for displaying avatars.
authorJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 10 Jul 2016 11:14:18 +0000 (11:14 +0000)
committerJean-Philippe Lang <jp_lang@yahoo.fr>
Sun, 10 Jul 2016 11:14:18 +0000 (11:14 +0000)
git-svn-id: http://svn.redmine.org/redmine/trunk@15624 e93f8b46-1217-0410-a6f0-8f06a7374b81

app/controllers/issues_controller.rb
app/helpers/watchers_helper.rb

index b842023a780debb0b3f1841a3e3d2370aeb9ccb3..27bb4abf2dda0b29cb25a4d2b210d90c54204d4f 100644 (file)
@@ -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)
index 7ed7b8914ba27c1d56d0bfa94d4251bbbbb63c88..b3e23a47fd394b93be52b564cbe10593691e268a 100644 (file)
@@ -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')