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.)

2 Likes

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.

4 Likes

For what it’s worth, I’ve been deleting those “Listed” replies. As far as I can tell, they are noise in the specific case of blog comments since every topic will either be hidden or have the notice. If there’s some reason to count them, maybe the better approach is to automatically remove them from blog comments. (I don’t currently have a patch for this, so I don’t know if it’s challenging or not.)

1 Like

It is odd that listing/unlisting/closing a topic is counted as a “Reply”.

1 Like

Yes, it is odd that small action posts are being counted as a reply. There is also another bug related to this - if the first reply in an embedded topic is a small action post, it breaks the embedded HTML so that no link is displayed to the associated Discourse topic. We are working on a fix for both of these issues now.

2 Likes

I fixed it in the below PR

5 Likes