Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Intermittent wrong comment count on PRs #16901

Closed
2 tasks done
noerw opened this issue Aug 31, 2021 · 8 comments · Fixed by #18260
Closed
2 tasks done

Intermittent wrong comment count on PRs #16901

noerw opened this issue Aug 31, 2021 · 8 comments · Fixed by #18260
Labels
Milestone

Comments

@noerw
Copy link
Member

noerw commented Aug 31, 2021

Description

A PR is listed as having comments, while none show up in the PR detail view (see gitea.com example above.)

This may be about approving reviews, and is probably caused by a fairly recent change, as an older PR has an approval too, but does not list additional comments that are not visible on the PR detail page.

The API also returns a higher comment count, while not returning any comments

Screenshots

Screenshot_20210831_094952
Screenshot_20210831_095048

@noerw noerw added the type/bug label Aug 31, 2021
@noerw noerw added this to the 1.16.0 milestone Aug 31, 2021
@noerw
Copy link
Member Author

noerw commented Sep 1, 2021

hmm, now the comment count on that specific issue is correct, without further action (to my knowledge).. 🤔

@noerw
Copy link
Member Author

noerw commented Oct 12, 2021

This is a regression of #16075:
It adds reviews to the comment counter on a PR, but

  • this does not check if the review has a comment body
  • this deviates from the logic of CheckRepoStats(), which runs via cronjob and corrects the counter again

I'm not sure if we actually should add reviews to the comment counter. It intuitively makes sense, but brings issues in other aspects of Gitea:
This count is also returned in the API, and is likely to be used as a indication how many comments to fetch for an issue. Problem is, the comments API does not return reviews as comments, leading to bad state in API clients.
So either that API needs to be changed as well to return review comments as well (seems also intuitive), or we should just revert the change from #16075

@noerw noerw modified the milestones: 1.16.0, 1.15.5 Oct 12, 2021
@noerw noerw self-assigned this Oct 12, 2021
@noerw noerw changed the title wrong comment count on PRs (caused by reviews?) Intermittent wrong comment count on PRs Oct 12, 2021
@noerw
Copy link
Member Author

noerw commented Oct 13, 2021

github does the following:

  • in the UI, they count any comment (including code comments) that has a body.
  • the /pulls/{index}/comments API endpoint only returns non-review comments
  • the /pulls/{index} endpoint returns two separate counters comments + review_comments

this feels like a reasonable solution, that could even be backported

@6543 6543 modified the milestones: 1.15.5, 1.15.6 Oct 20, 2021
@lunny lunny modified the milestones: 1.15.6, 1.15.7 Oct 28, 2021
@lunny
Copy link
Member

lunny commented Nov 9, 2021

It seems now it's correct. I think maybe we could close this one and remove it from v1.15.7 .

@noerw
Copy link
Member Author

noerw commented Nov 9, 2021

No this bug is not fixed yet, just reproduced on 1.15.6 and gitea.com.
I'm currently short on time, but I'll try to come up with a fix in the coming days

@noerw noerw removed their assignment Nov 9, 2021
@lunny
Copy link
Member

lunny commented Dec 1, 2021

If we follow Github's method, we need a new number column but I think it's difficult to add a new column in a stable version. Maybe we can do it in v1.16 if possible. I'll move this to v1.15.8

@lunny lunny modified the milestones: 1.15.7, 1.15.8 Dec 1, 2021
@lunny
Copy link
Member

lunny commented Dec 19, 2021

Could you have time to confirm if it's gone?

@zeripath zeripath modified the milestones: 1.15.8, 1.15.9 Dec 19, 2021
@6543 6543 modified the milestones: 1.15.9, 1.15.10 Dec 30, 2021
@noerw
Copy link
Member Author

noerw commented Jan 12, 2022

fyi: bug is still present.
@lunny I'll submit a bugfix for 1.15.10 that reverts this two line change of #16075 so we at least have consistent state back.

In a followup for 1.16 or 1.17 we can aim at implementing PR comment counts similar to github with separate counters.

@lunny lunny closed this as completed Jan 13, 2022
@go-gitea go-gitea locked and limited conversation to collaborators Apr 28, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants