Fix user_badges n+1 query.
Merge pull request #2274 from vikhyat/badge-system

Fix user_badges n+1 query