···3import (4 "cmp"5 "database/sql"06 "fmt"7 "maps"8 "slices"···231 p.Submissions = submissions232 }233 }0234 // collect allLabels for each issue235 allLabels, err := GetLabels(e, FilterIn("subject", pullAts))236 if err != nil {···240 for pullAt, labels := range allLabels {241 if p, ok := pulls[pullAt]; ok {242 p.Labels = labels00000000000000000000000243 }244 }245
···3import (4 "cmp"5 "database/sql"6+ "errors"7 "fmt"8 "maps"9 "slices"···230 p.Submissions = submissions231 }232 }233+234 // collect allLabels for each issue235 allLabels, err := GetLabels(e, FilterIn("subject", pullAts))236 if err != nil {···238 for pullAt, labels := range allLabels {239 if p, ok := pulls[pullAt]; ok {240 p.Labels = labels241+ }242+ }243+244+ // collect pull source for all pulls that need it245+ var sourceAts []syntax.ATURI246+ for _, p := range pulls {247+ if p.PullSource.RepoAt != nil {248+ sourceAts = append(sourceAts, *p.PullSource.RepoAt)249+ }250+ }251+ sourceRepos, err := GetRepos(e, 0, FilterIn("at_uri", sourceAts))252+ if err != nil && !errors.Is(err, sql.ErrNoRows) {253+ return nil, fmt.Errorf("failed to get source repos: %w", err)254+ }255+ sourceRepoMap := make(map[syntax.ATURI]*models.Repo)256+ for _, r := range sourceRepos {257+ sourceRepoMap[r.RepoAt()] = &r258+ }259+ for _, p := range pulls {260+ if p.PullSource.RepoAt != nil {261+ if sourceRepo, ok := sourceRepoMap[*p.PullSource.RepoAt]; ok {262+ p.PullSource.Repo = sourceRepo263+ }264 }265 }266