Pull down all non-code notes (#14)

This commit changes the filter on the API response so that we are only
filtering out system level notes. This means we get notes that are not
linked to specific locations in the code.

Subsequent work will have to separate these types of notes from the
other code-linked notes and probably display them in some sort of
separate tree.
This commit is contained in:
Harrison (Harry) Cramer
2023-08-04 14:25:58 -04:00
committed by GitHub
parent 22389fdb3d
commit f15711edab
3 changed files with 40 additions and 24 deletions

View File

@@ -44,18 +44,18 @@ func (c *Client) ListDiscussions() ([]*gitlab.Discussion, int, error) {
return nil, res.Response.StatusCode, fmt.Errorf("Listing discussions failed: %w", err)
}
var realDiscussions []*gitlab.Discussion
var diffNotes []*gitlab.Discussion
for i := 0; i < len(discussions); i++ {
notes := discussions[i].Notes
for j := 0; j < len(notes); j++ {
if notes[j].Type == gitlab.NoteTypeValue("DiffNote") {
realDiscussions = append(realDiscussions, discussions[i])
if !notes[j].System {
diffNotes = append(diffNotes, discussions[i])
break
}
}
}
sortedDiscussions := SortableDiscussions(realDiscussions)
sortedDiscussions := SortableDiscussions(diffNotes)
sort.Sort(sortedDiscussions)
return sortedDiscussions, http.StatusOK, nil