mirror of
https://github.com/discourse/discourse.git
synced 2024-11-23 09:26:54 -06:00
PERF: Rendering crawler's template is expensive.
This commit is contained in:
parent
3d4cdd7040
commit
4e7e4cee7d
@ -9,8 +9,6 @@ class AboutController < ApplicationController
|
||||
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
# @list = list
|
||||
# store_preloaded(list.preload_key, MultiJson.dump(TopicListSerializer.new(list, scope: guardian)))
|
||||
render :index
|
||||
end
|
||||
format.json do
|
||||
|
@ -169,8 +169,12 @@ module ApplicationHelper
|
||||
MobileDetection.resolve_mobile_view!(request.user_agent,params,session)
|
||||
end
|
||||
|
||||
def crawler_layout?
|
||||
controller.try(:use_crawler_layout?)
|
||||
end
|
||||
|
||||
def include_crawler_content?
|
||||
controller.try(:use_crawler_layout?) || !mobile_view?
|
||||
crawler_layout? || !mobile_view?
|
||||
end
|
||||
|
||||
def mobile_device?
|
||||
|
@ -1,3 +1,5 @@
|
||||
<% if crawler_layout? %>
|
||||
|
||||
<% content_for :title do %><%=t "about" %><% end %>
|
||||
|
||||
<section itemscope itemtype="https://schema.org/AboutPage">
|
||||
@ -52,6 +54,8 @@
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%- stats = About.fetch_cached_stats %>
|
||||
|
||||
<section class='about stats'>
|
||||
<h2><%=t 'js.about.stats' %></h2>
|
||||
|
||||
@ -64,37 +68,39 @@
|
||||
</tr>
|
||||
<tr>
|
||||
<td class='title'><%=t 'js.about.topic_count' %></td>
|
||||
<td><%= @about.stats[:topic_count] %></td>
|
||||
<td><%= @about.stats[:topics_7_days] %></td>
|
||||
<td><%= @about.stats[:topics_30_days] %></td>
|
||||
<td><%= stats["topic_count"] %></td>
|
||||
<td><%= stats["topics_7_days"] %></td>
|
||||
<td><%= stats["topics_30_days"] %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%=t 'js.about.post_count' %></td>
|
||||
<td><%= @about.stats[:post_count] %></td>
|
||||
<td><%= @about.stats[:posts_7_days] %></td>
|
||||
<td><%= @about.stats[:posts_30_days] %></td>
|
||||
<td><%= stats["post_count"] %></td>
|
||||
<td><%= stats["posts_7_days"] %></td>
|
||||
<td><%= stats["posts_30_days"] %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%=t 'js.about.user_count' %></td>
|
||||
<td><%= @about.stats[:user_count] %></td>
|
||||
<td><%= @about.stats[:users_7_days] %></td>
|
||||
<td><%= @about.stats[:users_30_days] %></td>
|
||||
<td><%= stats["user_count"] %></td>
|
||||
<td><%= stats["users_7_days"] %></td>
|
||||
<td><%= stats["users_30_days"] %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%=t 'js.about.active_user_count' %></td>
|
||||
<td>—</td>
|
||||
<td><%= @about.stats[:active_users_7_days] %></td>
|
||||
<td><%= @about.stats[:active_users_30_days] %></td>
|
||||
<td><%= stats["active_users_7_days"] %></td>
|
||||
<td><%= stats["active_users_30_days"] %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td><%=t 'js.about.like_count' %></td>
|
||||
<td><%= @about.stats[:like_count] %></td>
|
||||
<td><%= @about.stats[:likes_7_days] %></td>
|
||||
<td><%= @about.stats[:likes_30_days] %></td>
|
||||
<td><%= stats["like_count"] %></td>
|
||||
<td><%= stats["likes_7_days"] %></td>
|
||||
<td><%= stats["likes_30_days"] %></td>
|
||||
</tr>
|
||||
</table>
|
||||
</section>
|
||||
|
||||
</section>
|
||||
<br/>
|
||||
<br/>
|
||||
<br/>
|
||||
|
||||
<% end %>
|
||||
|
Loading…
Reference in New Issue
Block a user