PERF: N+1 query on user summary page.

This commit is contained in:
Guo Xiang Tan 2016-09-23 12:44:08 +08:00
parent bddbfa56f6
commit 4e663998af
1 changed files with 5 additions and 1 deletions

View File

@ -33,7 +33,11 @@ class UsersController < ApplicationController
def show
raise Discourse::InvalidAccess if SiteSetting.hide_user_profiles_from_public && !current_user
@user = fetch_user_from_params(include_inactive: current_user.try(:staff?))
@user = fetch_user_from_params(
{ include_inactive: current_user.try(:staff?) },
[{ user_profile: :card_image_badge }]
)
user_serializer = UserSerializer.new(@user, scope: guardian, root: 'user')
# TODO remove this options from serializer