summaryrefslogtreecommitdiff
path: root/misc/dashboard/codereview
diff options
context:
space:
mode:
authorDavid Symonds <dsymonds@golang.org>2012-08-08 13:16:21 +1000
committerDavid Symonds <dsymonds@golang.org>2012-08-08 13:16:21 +1000
commit787c386e55299556726191835f399cb87065bf65 (patch)
tree16eb09af90c4b6970787c4437b2ccfa54db59c3d /misc/dashboard/codereview
parent3de7edbd69e024d4e254bba17f4a400568d664d7 (diff)
downloadgo-787c386e55299556726191835f399cb87065bf65.tar.gz
misc/dashboard/codereview: fixes for non-reviewers.
Also rename the testing CGI argument from "email" to "user". R=golang-dev, r CC=golang-dev http://codereview.appspot.com/6454117
Diffstat (limited to 'misc/dashboard/codereview')
-rw-r--r--misc/dashboard/codereview/dashboard/front.go29
-rw-r--r--misc/dashboard/codereview/index.yaml6
2 files changed, 24 insertions, 11 deletions
diff --git a/misc/dashboard/codereview/dashboard/front.go b/misc/dashboard/codereview/dashboard/front.go
index 1ef769365..c7b0f0fbf 100644
--- a/misc/dashboard/codereview/dashboard/front.go
+++ b/misc/dashboard/codereview/dashboard/front.go
@@ -39,11 +39,14 @@ func handleFront(w http.ResponseWriter, r *http.Request) {
var currentPerson string
u := data.User
you := "you"
- if e := r.FormValue("email"); e != "" {
+ if e := r.FormValue("user"); e != "" {
u = e
you = e
}
currentPerson, data.UserIsReviewer = emailToPerson[u]
+ if !data.UserIsReviewer {
+ currentPerson = u
+ }
var wg sync.WaitGroup
errc := make(chan error, 10)
@@ -63,10 +66,10 @@ func handleFront(w http.ResponseWriter, r *http.Request) {
}()
}
+ data.Tables[0].Title = "CLs assigned to " + you + " for review"
if data.UserIsReviewer {
tableFetch(0, func(tbl *clTable) error {
q := activeCLs.Filter("Reviewer =", currentPerson).Limit(maxCLs)
- tbl.Title = "CLs assigned to " + you + " for review"
tbl.Assignable = true
_, err := q.GetAll(c, &tbl.CLs)
return err
@@ -74,7 +77,13 @@ func handleFront(w http.ResponseWriter, r *http.Request) {
}
tableFetch(1, func(tbl *clTable) error {
- q := activeCLs.Filter("Author =", currentPerson).Limit(maxCLs)
+ q := activeCLs
+ if data.UserIsReviewer {
+ q = q.Filter("Author =", currentPerson)
+ } else {
+ q = q.Filter("Owner =", currentPerson)
+ }
+ q = q.Limit(maxCLs)
tbl.Title = "CLs sent by " + you
tbl.Assignable = true
_, err := q.GetAll(c, &tbl.CLs)
@@ -89,14 +98,12 @@ func handleFront(w http.ResponseWriter, r *http.Request) {
return err
}
// filter
- if data.UserIsReviewer {
- for i := len(tbl.CLs) - 1; i >= 0; i-- {
- cl := tbl.CLs[i]
- if cl.Author == currentPerson || cl.Reviewer == currentPerson {
- // Preserve order.
- copy(tbl.CLs[i:], tbl.CLs[i+1:])
- tbl.CLs = tbl.CLs[:len(tbl.CLs)-1]
- }
+ for i := len(tbl.CLs) - 1; i >= 0; i-- {
+ cl := tbl.CLs[i]
+ if cl.Owner == currentPerson || cl.Author == currentPerson || cl.Reviewer == currentPerson {
+ // Preserve order.
+ copy(tbl.CLs[i:], tbl.CLs[i+1:])
+ tbl.CLs = tbl.CLs[:len(tbl.CLs)-1]
}
}
return nil
diff --git a/misc/dashboard/codereview/index.yaml b/misc/dashboard/codereview/index.yaml
index d47dd0829..a87073cc4 100644
--- a/misc/dashboard/codereview/index.yaml
+++ b/misc/dashboard/codereview/index.yaml
@@ -8,6 +8,12 @@ indexes:
- kind: CL
properties:
+ - name: Owner
+ - name: Modified
+ direction: desc
+
+- kind: CL
+ properties:
- name: Closed
- name: Modified
direction: desc