Sign in

Search issue titles and bodies, change requests and comments. Private repositories you cannot read are not included.

vole
Clone

Read only, no credentials:

https://rodent.software/vole.git

Write over SSH with a registered key:

git clone ssh://git@rodent.software:2222/vole.git

A free and open-source forge that lives in your Git repo.

refactor

c5902451905acdaa478f8476844ccd4a510d9ca9 · Keenan Nemetz · 17d ago · parent ec2aba4b

internal/web/requests.go → server/web/requests.go +9−9

@@ -5,7 +5,7 @@ import (
5 5 "net/http"
6 6 "sort"
7 7
8 "github.com/rodent-software/vole/internal/requests"
8 "github.com/rodent-software/vole/metadata"
9 9 )
10 10
11 11 // Requests lists a repo's change requests. They are read straight from git: the
@@ -16,13 +16,13 @@ func (w *Web) Requests(rw http.ResponseWriter, r *http.Request) {
16 16 if !ok {
17 17 return
18 18 }
19 list, err := requests.Load(m.Git(), requests.Ref)
19 list, err := metadata.LoadRequests(m.Git(), metadata.Ref)
20 20 if err != nil {
21 21 http.Error(rw, "cannot read change requests: "+err.Error(), http.StatusInternalServerError)
22 22 return
23 23 }
24 24 want := r.URL.Query().Get("state")
25 rows := make([]*requests.Request, 0, len(list))
25 rows := make([]*metadata.Request, 0, len(list))
26 26 open := 0
27 27 for _, req := range list {
28 28 if req.State == "open" {
@@ -41,7 +41,7 @@ func (w *Web) Requests(rw http.ResponseWriter, r *http.Request) {
41 41 w.render(rw, "requests", struct {
42 42 Page
43 43 Name string
44 Rows []*requests.Request
44 Rows []*metadata.Request
45 45 State string
46 46 Open int
47 47 Total int
@@ -51,7 +51,7 @@ func (w *Web) Requests(rw http.ResponseWriter, r *http.Request) {
51 51 // RequestView renders one change request: what it would land, what changed, and
52 52 // which approvals currently apply.
53 53 type requestApproval struct {
54 requests.Approval
54 metadata.Approval
55 55 // Name is the approver's current name; the file itself is keyed by account id.
56 56 Name string
57 57 // Current is false when the approval names a commit or base that is no longer
@@ -65,12 +65,12 @@ func (w *Web) RequestView(rw http.ResponseWriter, r *http.Request) {
65 65 return
66 66 }
67 67 id := r.PathValue("id")
68 list, err := requests.Load(m.Git(), requests.Ref)
68 list, err := metadata.LoadRequests(m.Git(), metadata.Ref)
69 69 if err != nil {
70 70 http.Error(rw, "cannot read change requests: "+err.Error(), http.StatusInternalServerError)
71 71 return
72 72 }
73 var req *requests.Request
73 var req *metadata.Request
74 74 for _, x := range list {
75 75 if x.ID == id {
76 76 req = x
@@ -138,7 +138,7 @@ func (w *Web) RequestView(rw http.ResponseWriter, r *http.Request) {
138 138 // rev-parse per distinct (side, path) is a handful for a review thread, and it
139 139 // is exact where the diff's abbreviated ids would need prefix matching.
140 140 type renderedComment struct {
141 requests.Comment
141 metadata.Comment
142 142 Body template.HTML
143 143 // Current reports whether the file still holds the content this comment was
144 144 // written about. A stale comment keeps its place in the thread and loses its
@@ -240,7 +240,7 @@ func (w *Web) RequestView(rw http.ResponseWriter, r *http.Request) {
240 240 w.render(rw, "request", struct {
241 241 Page
242 242 Name string
243 Request *requests.Request
243 Request *metadata.Request
244 244 Description template.HTML
245 245 Approvals []requestApproval
246 246 Checks []checkRow