Skip to content

A platform for community discussion. Free, open, simple.

PERF: Preload user information when visiting user messages routes (#21929)

Alan Guo Xiang Tan2032d3c2fbfe
diff --git a/app/controllers/user_actions_controller.rb b/app/controllers/user_actions_controller.rb
index 24326698bb9..a166bca6f5b 100644
--- a/app/controllers/user_actions_controller.rb
+++ b/app/controllers/user_actions_controller.rb
@@ -36,11 +36,6 @@ class UserActionsController < ApplicationController
render_serialized(UserAction.stream_item(params[:id], guardian), UserActionSerializer)
end
- def private_messages
- # DO NOT REMOVE
- # TODO should preload messages to avoid extra http req
- end
-
private
def user_actions_params
diff --git a/config/routes.rb b/config/routes.rb
index 82f8d115562..bcf2803de67 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -521,29 +521,28 @@ Discourse::Application.routes.draw do
:constraints => {
token: /[0-9a-f]+/,
}
- get "#{root_path}/:username/private-messages" => "user_actions#private_messages",
+ get "#{root_path}/:username/private-messages" => "users#show",
:constraints => {
username: RouteFormat.username,
}
- get "#{root_path}/:username/private-messages/:filter" => "user_actions#private_messages",
+ get "#{root_path}/:username/private-messages/:filter" => "users#show",
:constraints => {
username: RouteFormat.username,
}
- get "#{root_path}/:username/messages" => "user_actions#private_messages",
+ get "#{root_path}/:username/messages" => "users#show",
:constraints => {
username: RouteFormat.username,
}
- get "#{root_path}/:username/messages/:filter" => "user_actions#private_messages",
+ get "#{root_path}/:username/messages/:filter" => "users#show",
:constraints => {
username: RouteFormat.username,
}
- get "#{root_path}/:username/messages/group/:group_name" => "user_actions#private_messages",
+ get "#{root_path}/:username/messages/group/:group_name" => "users#show",
:constraints => {
username: RouteFormat.username,
group_name: RouteFormat.username,
}
- get "#{root_path}/:username/messages/group/:group_name/:filter" =>
- "user_actions#private_messages",
+ get "#{root_path}/:username/messages/group/:group_name/:filter" => "users#show",
:constraints => {
username: RouteFormat.username,
group_name: RouteFormat.username,