@@ -2,6 +2,7 @@ package app
22
33import (
44 "net/http"
5+ "slices"
56 "sort"
67 "sync"
78 "time"
@@ -90,18 +91,16 @@ func (a discussionsListerService) ServeHTTP(w http.ResponseWriter, r *http.Reque
9091 },
9192 }
9293
93- discussions , res , err := a .client .ListMergeRequestDiscussions (a .projectInfo .ProjectId , a .projectInfo .MergeId , & mergeRequestDiscussionOptions )
94+ it , hasErr := gitlab .Scan (func (p gitlab.PaginationOptionFunc ) ([]* gitlab.Discussion , * gitlab.Response , error ) {
95+ return a .client .ListMergeRequestDiscussions (a .projectInfo .ProjectId , a .projectInfo .MergeId , & mergeRequestDiscussionOptions , p )
96+ })
97+ discussions := slices .Collect (it )
9498
95- if err != nil {
99+ if err := hasErr (); err != nil {
96100 handleError (w , err , "Could not list discussions" , http .StatusInternalServerError )
97101 return
98102 }
99103
100- if res .StatusCode >= 300 {
101- handleError (w , GenericError {r .URL .Path }, "Could not list discussions" , res .StatusCode )
102- return
103- }
104-
105104 /* Filter out any discussions started by a blacklisted user
106105 and system discussions, then return them sorted by created date */
107106 var unlinkedDiscussions []* gitlab.Discussion
@@ -124,7 +123,7 @@ func (a discussionsListerService) ServeHTTP(w http.ResponseWriter, r *http.Reque
124123
125124 /* Collect IDs in order to fetch emojis */
126125 var noteIds []int64
127- for _ , discussion := range discussions {
126+ for _ , discussion := range slices . Concat ( linkedDiscussions , unlinkedDiscussions ) {
128127 for _ , note := range discussion .Notes {
129128 noteIds = append (noteIds , note .ID )
130129 }
0 commit comments