- commit
- 570852b
- parent
- 457c062
- author
- Eric Bower
- date
- 2024-06-24 13:41:10 -0400 EDT
fix: repo list
3 files changed,
+11,
-5
M
pr.go
+7,
-1
1@@ -84,11 +84,17 @@ func (pr PrCmd) GetReposWithLatestPr() ([]RepoWithLatestPr, error) {
2 }
3
4 for _, repo := range pr.Backend.Cfg.Repos {
5+ found := false
6 for _, curRepo := range repos {
7 if curRepo.ID == repo.ID {
8- continue
9+ found = true
10 }
11 }
12+ if !found {
13+ repos = append(repos, RepoWithLatestPr{
14+ Repo: &repo,
15+ })
16+ }
17 }
18
19 return repos, nil
+1,
-1
1@@ -1,6 +1,6 @@
2 {{define "pr-list-item"}}
3 <div>
4- <div><a href="{{.Url}}">{{.Text}}</a> <code>{{.Status}}</code></div>
5+ <div style="margin-bottom: 0.15rem;"><a href="{{.Url}}">{{.Text}}</a> <code>{{.Status}}</code></div>
6 <div>
7 <code>#{{.ID}}</code>
8 <span>opened on <date>{{.Date}}</date> by </span>
M
web.go
+3,
-3
1@@ -86,7 +86,7 @@ type LinkData struct {
2 type RepoData struct {
3 LinkData
4 Desc string
5- LatestPr PrListData
6+ LatestPr *PrListData
7 }
8
9 type RepoListData struct {
10@@ -109,10 +109,10 @@ func repoListHandler(w http.ResponseWriter, r *http.Request) {
11
12 repoData := []RepoData{}
13 for _, repo := range repos {
14- var ls PrListData
15+ var ls *PrListData
16 if repo.PatchRequest != nil {
17 curpr := repo.PatchRequest
18- ls = PrListData{
19+ ls = &PrListData{
20 ID: curpr.ID,
21 Pubkey: curpr.Pubkey,
22 LinkData: LinkData{