Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/diaspora/diaspora.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'app/presenters/node_info_presenter.rb')
-rw-r--r--app/presenters/node_info_presenter.rb18
1 files changed, 11 insertions, 7 deletions
diff --git a/app/presenters/node_info_presenter.rb b/app/presenters/node_info_presenter.rb
index e0c2c579b..8eeda65d3 100644
--- a/app/presenters/node_info_presenter.rb
+++ b/app/presenters/node_info_presenter.rb
@@ -105,15 +105,19 @@ class NodeInfoPresenter
end
def local_posts
- @local_posts ||= Post.where(type: "StatusMessage")
- .joins(:author)
- .where("owner_id IS NOT null")
- .count
+ Rails.cache.fetch("NodeInfoPresenter/local_posts", expires_in: 1.hour) do
+ @local_posts ||= Post.where(type: "StatusMessage")
+ .joins(:author)
+ .where.not(people: {owner_id: nil})
+ .count
+ end
end
def local_comments
- @local_comments ||= Comment.joins(:author)
- .where("owner_id IS NOT null")
- .count
+ Rails.cache.fetch("NodeInfoPresenter/local_comments", expires_in: 1.hour) do
+ @local_comments ||= Comment.joins(:author)
+ .where.not(people: {owner_id: nil})
+ .count
+ end
end
end