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:
parent
8c7cce1bfc
commit
130dbf7358
4 changed files with 14 additions and 5 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue