2
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2025-09-06 10:50:21 +08:00

PERF: don't run stats query in user card

This commit is contained in:
Sam 2015-02-24 13:31:23 +11:00
parent 8c7cce1bfc
commit 130dbf7358
4 changed files with 14 additions and 5 deletions

View file

@ -1,5 +1,7 @@
class UserSerializer < BasicUserSerializer
attr_accessor :omit_stats
def self.staff_attributes(*attrs)
attributes(*attrs)
attrs.each do |attr|
@ -171,6 +173,10 @@ class UserSerializer < BasicUserSerializer
scope.can_edit_name?(object)
end
def include_stats?
!omit_stats == true
end
def stats
UserAction.stats(object.id, scope)
end