BUGFIX: remove N+1 on topic lists

This commit is contained in:
Régis Hanol 2014-05-12 10:11:05 +02:00
parent 5f2c2efb47
commit b018b4ad18

View file

@ -22,7 +22,11 @@ class TopicList
# copy side-loaded data (allowed users) before dumping it with the .to_a
@topics_input.each do |t|
t.allowed_user_ids = t.allowed_users.map { |u| u.id }.to_a
t.allowed_user_ids = if @filter == :private_messages
t.allowed_users.map { |u| u.id }.to_a
else
[]
end
end
@topics = @topics_input.to_a