devapp: add more tags to reviews dashboard

Adds tags for trybot results, release milestones of issues the CL
is referencing, and Code-Review: -1.

Fixes golang/go#30576

Change-Id: Idcfe31a3953619218a2e1c9b75f80813dd4158ef
Reviewed-on: https://go-review.googlesource.com/c/build/+/199646
Run-TryBot: Andrew Bonventre <andybons@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Alexander Rakoczy <alex@golang.org>
diff --git a/devapp/reviews.go b/devapp/reviews.go
index 7634c51..2f363b6 100644
--- a/devapp/reviews.go
+++ b/devapp/reviews.go
@@ -43,11 +43,15 @@
 	LastUpdate          time.Time
 	FormattedLastUpdate string
 
-	HasPlusTwo      bool
-	HasPlusOne      bool
-	HasMinusTwo     bool
-	NoHumanComments bool
-	SearchTerms     string
+	HasPlusTwo       bool
+	HasPlusOne       bool
+	HasMinusOne      bool
+	HasMinusTwo      bool
+	NoHumanComments  bool
+	TryBotMinusOne   bool
+	TryBotPlusOne    bool
+	SearchTerms      string
+	ReleaseMilestone string
 }
 
 type reviewsData struct {
@@ -146,6 +150,20 @@
 			if c.NoHumanComments {
 				searchTerms = append(searchTerms, "t:attn")
 			}
+
+			const releaseMilestonePrefix = "Go"
+			for _, ref := range cl.GitHubIssueRefs {
+				issue := ref.Repo.Issue(ref.Number)
+				if issue != nil &&
+					issue.Milestone != nil &&
+					strings.HasPrefix(issue.Milestone.Title, releaseMilestonePrefix) {
+					c.ReleaseMilestone = issue.Milestone.Title[len(releaseMilestonePrefix):]
+				}
+			}
+			if c.ReleaseMilestone != "" {
+				searchTerms = append(searchTerms, "release:"+c.ReleaseMilestone)
+			}
+
 			searchTerms = append(searchTerms, searchTermsFromReviewerFields(cl)...)
 			for label, votes := range cl.Metas[len(cl.Metas)-1].LabelVotes() {
 				for _, val := range votes {
@@ -154,6 +172,9 @@
 						case -2:
 							c.HasMinusTwo = true
 							searchTerms = append(searchTerms, "t:-2")
+						case -1:
+							c.HasMinusOne = true
+							searchTerms = append(searchTerms, "t:-1")
 						case 1:
 							c.HasPlusOne = true
 							searchTerms = append(searchTerms, "t:+1")
@@ -162,6 +183,16 @@
 							searchTerms = append(searchTerms, "t:+2")
 						}
 					}
+					if label == "TryBot-Result" {
+						switch val {
+						case -1:
+							c.TryBotMinusOne = true
+							searchTerms = append(searchTerms, "trybot:-1")
+						case 1:
+							c.TryBotPlusOne = true
+							searchTerms = append(searchTerms, "trybot:+1")
+						}
+					}
 				}
 			}
 
diff --git a/devapp/templates/reviews.tmpl b/devapp/templates/reviews.tmpl
index 73fe8af..5301882 100644
--- a/devapp/templates/reviews.tmpl
+++ b/devapp/templates/reviews.tmpl
@@ -82,7 +82,7 @@
   height: 20px;
   margin-right: 1.5em;
   text-align: right;
-  width: 7em;
+  width: 12em;
 }
 .number {
   margin-right: 1.5em;
@@ -114,12 +114,18 @@
 .plus-one {
   background-color: #dcedc8;
 }
+.minus-one {
+  background-color: #fdaeb7;
+}
 .minus-two {
   background-color: #b71c1c;
 }
 .no-human-comments {
   background-color: #e0e0e0;
 }
+.release-milestone {
+  background-color: #a0e8ff;
+}
 [hidden] {
   display: none;
 }
@@ -166,8 +172,12 @@
           <span class="icons">
             {{if .NoHumanComments}}<a class="pill no-human-comments" href="?q=t%3Aattn" title="Has no human comments">→</a>{{end}}
             {{if .HasMinusTwo}}️<a class="pill minus-two" href="?q=t%3A-2" title="Code-Review: -2">-2</a>{{end}}
+            {{if .HasMinusOne}}<a class="pill minus-one" href="?q=t%3A-1" title="Code-Review: -1">-1</a>{{end}}
             {{if .HasPlusOne}}<a class="pill plus-one" href="?q=t%3A%2B1" title="Code-Review: +1">+1</a>{{end}}
             {{if .HasPlusTwo}}<a class="pill plus-two" href="?q=t%3A%2B2" title="Code-Review: +2">+2</a>{{end}}
+            {{if .TryBotMinusOne}}<a class="pill minus-one" href="?q=trybot%3A-1" title="Run-TryBot: -1">🤖-1</a>{{end}}
+            {{if .TryBotPlusOne}}<a class="pill plus-one" href="?q=trybot%3A%2B1" title="Run-TryBot: +1">🤖+1</a>{{end}}
+            {{if .ReleaseMilestone}}<a class="pill release-milestone" href="?q=release%3A{{.ReleaseMilestone}}" title="References an issue in Go{{.ReleaseMilestone}}">{{.ReleaseMilestone}}</a>{{end}}
           </span>
           <a class="number" href="https://{{$p.ReviewServer}}/{{.Number}}" target="_blank">{{.Number}}</a>
           <span class="subject">