Embed: reply count is off by one

AI-generated summary

A bug report by probus highlights that the reply count in embedded Discourse comments is off by one. When an embed displays a subset of comments, the count of remaining replies is incorrectly calculated, often showing one extra reply than actually exists. downey requested clarification on the feature, while codinghorror suggested the issue stems from a recent shift in how posts are counted versus replies. probus provided screenshots and context, noting the issue occurs consistently on the Coding Horror blog. Although Mittineague speculated about deleted posts affecting the count, probus confirmed the discrepancy happens regardless. The issue was resolved by techAPJ, who implemented a fix in pull request 3450.

Count for how many more replies there are in the topic is off by one in embedded comments.

Say the comment topic has the opening post + 7 comments and you configure embed to show only 5 comments. It will tell the users (correctly) that there are 7 replies, show five of them (correctly) and then tell there are 3 more replies in the forum (incorrect).

1 me gusta

What are “embedded comments” and where can I look to see this reply count?

Perhaps you can provide some detailed steps to reproduce this bug?

Probably related to Sam’s change to switch from Posts (count includes first post) to replies (count does not include first post). Might be an easy fix @techapj you can check to see if counts are off on codinghorror embedding.

Embedded comments are Discourse topics embedded in an iframe as comments for a static website. See for example: Where Are The High Resolution Displays?

I’m guessing codinghorror blog has the default limit of 100 embedded comments (since I don’t care to count..), so that should be “12 more replies”

1 me gusta

Does the topic have any Deleted posts that might be throwing the count off?

Obviously I can’t say for codinghorror blog, but no, deleted posts don’t matter. It is off by one every time.

Thanks for reporting it @probus! Fixed :ant:

https://github.com/discourse/discourse/pull/3450

2 Me gusta