mirror of
https://github.com/discourse/discourse.git
synced 2025-09-08 12:06:51 +08:00
PERF: optimise query that gathers topic tracking state
(this query runs on the front page to figure out new and unread topics)
This commit is contained in:
parent
6d9674278e
commit
343e417a55
3 changed files with 77 additions and 41 deletions
|
@ -307,7 +307,7 @@ class ApplicationController < ActionController::Base
|
|||
|
||||
def preload_current_user_data
|
||||
store_preloaded("currentUser", MultiJson.dump(CurrentUserSerializer.new(current_user, scope: guardian, root: false)))
|
||||
serializer = ActiveModel::ArraySerializer.new(TopicTrackingState.report([current_user.id]), each_serializer: TopicTrackingStateSerializer)
|
||||
serializer = ActiveModel::ArraySerializer.new(TopicTrackingState.report(current_user.id), each_serializer: TopicTrackingStateSerializer)
|
||||
store_preloaded("topicTrackingStates", MultiJson.dump(serializer))
|
||||
end
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue