Just Curious: How exactly does profile views work?

I have been exploring the UserProfileViews model and the User controller hoping to find out exactly how this feature works. I get the basics of how it’s sending the current user’s id and the profile’s user id to the DB but what triggers saying, “Hey, this user is on this profile!”

Is it as simple as, this user just went to user/anotheruser/activity? If so, where is this reflected in the code?

If you look in discourse/config/routes.rb you will see how the route is defined.
Which calls the UsersController then the show method in that controller.

2 Likes