gitlab.nvim icon indicating copy to clipboard operation
gitlab.nvim copied to clipboard

discussions tree does not contain all discussions

Open jakubbortlik opened this issue 1 year ago • 9 comments
trafficstars

Prerequsities

  • [x] The "Troubleshooting" section of the README did not help
  • [x] I've installed the required dependencies
  • [x] I'm on the latest version of the plugin

Bug Description

  • The discussions tree does not contain all the discussions that are shown in Gitlab in the browser.
  • This is because gitlab.nvim only makes one request for 1 page with 250 items/discussions, but Gitlab has a limit of 100 items per page.

I've implemented a naive fix in #183, but there will be a better way of getting the correct number of pages to retrieve.

jakubbortlik avatar Feb 14 '24 16:02 jakubbortlik

Do you actually have an MR with over 100 separate discussions? That seems kind of absurd 😆

If you do, I'd guess that you're including conversations from CI... I'd suggest using the blacklist functionality if so to remove those results from the plugin...?

harrisoncramer avatar Feb 26 '24 13:02 harrisoncramer

Hi @harrisoncramer I should have described it more clearly right away. In that particular case, there were just 55 discussion threads but also a large number of commits - a colleague just likes to commit and push every single change. And all those commit notes are only filtered out in the if block that starts at line 92 in cmd/list_discussions.go, but they still add up to the 100 "discussions" that gitlab.nvim is now able to process. The blacklist does not help in this case because it is only applied to the at most 100 "items" on the first "page".

These cases are probably rare, but still possible and I would be grateful if gitlab.nvim was able to handle them correctly.

jakubbortlik avatar Feb 26 '24 16:02 jakubbortlik

I've encountered this bug again with a MR that has just 26 discussion threads, but there are a large number of commits, some changes in the MR title, status (marked as ready, etc.). So for my purposes, I've fixed it in this branch, that I originally submitted in #183 - that PR was broken after merging in the emojis branch, but I've fixed it now. So maybe I could open that PR again. Or I'll just use my branch before this is fixed in another way in develop.

jakubbortlik avatar Feb 28 '24 13:02 jakubbortlik

I'd recommend waiting until the Go Gitlab library natively supports pagination helpers, they are working on that right now: https://github.com/xanzy/go-gitlab/pull/1875

harrisoncramer avatar Mar 29 '24 12:03 harrisoncramer