PERF: Use a separate route for user cards, and split user serializer (#8789)

Adds a new route `/u/{username}/card.json`, which has a reduced number of fields. This change is behind a hidden site setting, so we can test compatibility before rolling out.
This commit is contained in:
David Taylor
2020-01-28 11:55:46 +00:00
committed by GitHub
parent c344f43211
commit 25fd2b544a
8 changed files with 281 additions and 209 deletions

View File

@@ -478,6 +478,7 @@ Discourse::Application.routes.draw do
get "#{root_path}/:username/profile-hidden" => "users#profile_hidden"
put "#{root_path}/:username/feature-topic" => "users#feature_topic", constraints: { username: RouteFormat.username }
put "#{root_path}/:username/clear-featured-topic" => "users#clear_featured_topic", constraints: { username: RouteFormat.username }
get "#{root_path}/:username/card.json" => "users#show_card", format: :json, constraints: { username: RouteFormat.username }
end
get "user-badges/:username.json" => "user_badges#username", constraints: { username: RouteFormat.username }, defaults: { format: :json }

View File

@@ -1976,6 +1976,11 @@ uncategorized:
default: ""
hidden: true
enable_new_user_card_route:
default: false
client: true
hidden: true
user_preferences:
default_email_digest_frequency:
enum: "DigestEmailSiteSetting"