PERF: disable PM stats when explicitly omitting stats

This commit is contained in:
Sam 2015-02-24 13:39:31 +11:00
parent 130dbf7358
commit e9c5e17fbe
1 changed files with 4 additions and 0 deletions

View File

@ -252,6 +252,10 @@ class UserSerializer < BasicUserSerializer
CategoryUser.lookup(object, :watching).pluck(:category_id)
end
def include_private_message_stats?
can_edit && !(omit_stats == true)
end
def private_messages_stats
UserAction.private_messages_stats(object.id, scope)
end