BUGFIX: staff counters weren't taking into acount deleted posts/actions

This commit is contained in:
Régis Hanol 2014-07-02 22:33:18 +02:00
parent 791fb704f7
commit 9abef57312
1 changed files with 6 additions and 3 deletions

View File

@ -170,20 +170,23 @@ class UserSerializer < BasicUserSerializer
Post.with_deleted Post.with_deleted
.where(user_id: object.id) .where(user_id: object.id)
.where(user_deleted: false) .where(user_deleted: false)
.where.not(deleted_by: object.id) .where.not(deleted_by_id: object.id)
.count .count
end end
def number_of_flagged_posts def number_of_flagged_posts
Post.with_deleted Post.with_deleted
.where(user_id: object.id) .where(user_id: object.id)
.where(hidden: true) .where(id: PostAction.with_deleted
.where(post_action_type_id: PostActionType.notify_flag_type_ids)
.select(:post_id))
.count .count
end end
def number_of_flags_given def number_of_flags_given
PostAction.where(post_action_type_id: PostActionType.notify_flag_type_ids) PostAction.with_deleted
.where(user_id: object.id) .where(user_id: object.id)
.where(post_action_type_id: PostActionType.notify_flag_type_ids)
.count .count
end end