We have a webhook on the event “user_logged_in”. The Payload contains the property post_count for the user that just logged in. Although the user did write 2 posts, the payload reads post_count: 0. This looks like a bug to me.
The receiver of the webhook needs this user stat to decide how to proceed.
I have to correct myself: The post_count is not always zero. When checking with my own user, the post_count was plausible (though I don’t know whether it is accurate or not).
But there is a user on our site, let’s call it user #1234, for which the following holds:
SELECT * FROM posts WHERE user_id=1234 returns two entries in the table. These are the posts that are also listed in the user’s profile activity page
The webhook payload, when this user logs in or out, contains "post_count": 0.
I tested, and the post count isn’t updated in real-time.
My guess is that there’s a Sidekiq job that takes care of that periodically, but I don’t know which one.
It doesn’t seem there’s a specific related Sidekiq job
But I read that this stat is updated at least once a day.
Maybe there is a confusion with “topics” and “posts”. I expected that creating a new topic is just a special type of post. The database structure supports that.
But when checking the user profile statistics, they say something along the lines “2 topics created, 0 posts created”.
So maybe the “post_count” that I get is rather the number of replies to topics than the number of all posts?
On the other hand, there is a date “last_posted_at” which contains the date when the last topic was created. So at least, there is some inconsistency in naming here. I would expect the number “post_count” to include first posts in new topics, as well.
Anyway, whether this is intended behavior or not, I do not find a topic_count or alike in the user json. How do I find out the total number of posts, including new topics?