FIX: only show agreed abd deferred flags on user's profile

This commit is contained in:
Régis Hanol
2014-10-09 16:10:16 +02:00
parent f834a5fe4e
commit 7e8c4b63f4
3 changed files with 51 additions and 6 deletions

View File

@@ -179,21 +179,21 @@ class UserSerializer < BasicUserSerializer
.where(user_id: object.id)
.where(user_deleted: false)
.where.not(deleted_by_id: object.id)
.where.not(deleted_at: nil)
.count
end
def number_of_flagged_posts
Post.with_deleted
.where(user_id: object.id)
.where(id: PostAction.with_deleted
.where(post_action_type_id: PostActionType.notify_flag_type_ids)
.where(id: PostAction.where(post_action_type_id: PostActionType.notify_flag_type_ids)
.where(disagreed_at: nil)
.select(:post_id))
.count
end
def number_of_flags_given
PostAction.with_deleted
.where(user_id: object.id)
PostAction.where(user_id: object.id)
.where(post_action_type_id: PostActionType.notify_flag_type_ids)
.count
end