Last version is ignoring request coming from API to update user visits stats in forum.
Other stats like ‘number of likes’ or ‘pageviews’ are right, but it seems that something has happened with user visit stats.
Before, when i pulled for latest topics or post in topics, it updated the User#last_seen_at dates, but now there are now 9 days ago, I don’t have any new visit from my users, when normally i have hundreds.
When i visit the user active list page in ‘/admin/users/list/active’, i see the ‘seen’ column fixed to date when i did the update.
I updated from 2.2.0.beta3 to last current version 2.3.0.beta1 and i didn’t have any issue while updating.
No, there isn’t one. If you have control over the API server you could try and “trick” discourse into updating last seen for the request. From the code I quoted above you can see how it works.
So you could make a request with “X-Requested-With" header containing “XMLHttpRequest” (to trick the xhr? bit), and “DISCOURSE_VISIBLE” as “true”.
Note that this wouldn’t be a “supported” way to use the API, but I don’t foresee any problems.
The API is typically used for things where users are not present - for example the official Discourse mobile app uses the API to check for new topics in the background.
I would expect a user viewing something via API to be the same as if they hit that API via their browser.
I feel like that is an exception to the principle of least surprise.
I understand why that decision was made, but perhaps we could accept a HTTP header or parameter that indicates if we want to treat the user as a regular user?