forum: optimize unread forum topics on forum index.
Avoid doing one SQL query per topic when checking for new topics on the forum index. This also changes it so that forum topics aren't always marked as new for anonymous users.
This commit is contained in:
@@ -24,6 +24,8 @@ class ForumTopicsController < ApplicationController
|
||||
params[:limit] ||= 40
|
||||
|
||||
@forum_topics = ForumTopic.paginated_search(params)
|
||||
@read_forum_topics = @forum_topics.read_by_user(CurrentUser.user)
|
||||
|
||||
@forum_topics = @forum_topics.includes(:creator, :updater).load if request.format.html?
|
||||
@forum_topics = @forum_topics.includes(:creator, :original_post).load if request.format.atom?
|
||||
|
||||
|
||||
Reference in New Issue
Block a user