Contagem de respostas em comentários de blog com um a menos

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 curtidas

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 curtidas

Por que não, tenho estado a apagar essas respostas “Listadas”. Pelo que pude perceber, elas são ruído no caso específico de comentários em blogs, já que todo tópico será ocultado ou terá o aviso. Se houver algum motivo para contá-las, talvez a melhor abordagem seja removê-las automaticamente dos comentários de blogs. (No momento, não tenho um patch para isso, então não sei se é desafiador ou não.)

1 curtida

É estranho que listar/deslistar/fechar um tópico seja contado como uma “Resposta”.

1 curtida

Sim, é estranho que postagens de pequenas ações estejam sendo contadas como respostas. Há também outro bug relacionado a isso: se a primeira resposta em um tópico incorporado for uma postagem de pequena ação, o HTML incorporado é quebrado, fazendo com que nenhum link seja exibido para o tópico do Discourse associado. Estamos trabalhando em uma correção para ambos os problemas agora.

2 curtidas

Eu corrigi isso no PR abaixo

5 curtidas