From f9f12ed221f4d8600f07c387826ff42c5b4141ec Mon Sep 17 00:00:00 2001 From: Vinoth Kannan Date: Mon, 3 Jun 2019 21:47:33 +0530 Subject: [PATCH] PERF: fix N+1 queries for non-JS topic view. --- app/views/topics/show.html.erb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/views/topics/show.html.erb b/app/views/topics/show.html.erb index 5e8ce1a5fed..9d921c58bc7 100644 --- a/app/views/topics/show.html.erb +++ b/app/views/topics/show.html.erb @@ -46,7 +46,8 @@ <%= "(#{u.name})" if (SiteSetting.display_name_on_posts && SiteSetting.enable_names? && !u.name.blank?) %> <% - who_username = post.custom_fields["action_code_who"] || "" + post_custom_fields = @topic_view.post_custom_fields[post.id] || {} + who_username = post_custom_fields["action_code_who"] || "" if post.action_code %> <%= t("js.action_codes.#{post.action_code}", when: "", who: who_username).html_safe %>