I’ve implemented this, and submitted a PR.
Before:
After:
The one thing I wasn’t sure about is what to do when users just have trust level badges, currently the following will happen:
I think it would make sense to make use of the space and display the rest of the trust level badges in a situation like this. However, I expect this is an incredibly rare occurrence (only found when a user has been granted trust levels rather then earned them), and I wonder if it’s therefore worth the added code complexity.
Speaking of code complexity, I spent a while staring at my screen trying to work out if I could make the featured_user_badges query more efficient, but didn’t come up with anything. We end up running the same subquery twice (to find the highest trust level badge a user has) and from what I can tell ActiveRecord doesn’t support WITH queries (which, if my understanding is correct, would mean the duplicated subquery is only ran once). I’m not sure how much of a performance impact this is, though. Again - some advice would be very welcome here.


