Reply count on blog comments off by one

I recently set up a Discourse instance to host blog comments. When someone posts the first comment, the embedded comment shows “2 Replies”. Before you ask, it’s not because the initial post is counted as a reply. That was fixed a while ago. Instead the problem seems to be the automatic listing notification:

Screen Shot 2021-04-28 at 9.40.24 AM

Since every blog post comment topic starts unlisted, every first comment unlists the topic which, in turn, counts as a reply.

So I think the fix would be something closer to this pull request that excludes small actions when counting message replies. Listing a topic is post_type 3, which is a small_action.

As an aside, the reply count is also off when looking at topic listings but it’s not quite so obvious because you aren’t looking at the count and the replies at the same time. And if you look at the topic itself, it’s not hard to figure out that the listing notice is counted. But when you look at the first few comments on a blog, it’s fairly obvious something is off because you see the count and the replies in one place. (And the listing notice isn’t displayed, thankfully.)

1 Like

The replies number that you see on the embedded topic list is derived from the same code as is used to set the replies count on the Discourse topic list, so possibly both issues need to be dealt with. I’m not sure if it intentional to include moderator action posts in the reply count on the Discourse topic list. Including moderator action posts in the reply count for embedded topics seems definitely wrong - especially since the first reply to all embedded topics is now a moderator post.

For examples of how moderator posts are included in the reply count in topic lists, have a look at this topic list: https://meta.discourse.org/?status=closed. The post that is created when a topic is closed is always counted as a reply. Maybe only regular posts should be counted.

3 Likes