DEV: Allow plugins to hide user stats by new guardian method (PR #9772)


@eviltrout This allows plugins to override the can_see_summary_stats? method in UserGuardian. This will remove all the user stats from the serializer, and then the UI will hide the entire section.

It is the least DRY code I have seen…

I think you can replace all of this by:

showStats: or("model.time_read", "model.days_visited", "model.topics_entered", ...)

@eviltrout I am not sure if you prefer an attribute accessor, or the method to expose @user from UserSummary, but it would be really nice to expose it, to avoid extra queries for no reason.

I would not even bother making this property, myself. You can have the template check model.can_see_summary_stats directly.

Just a minor suggestion.