зеркало из https://github.com/golang/build.git
maintner, devapp: display proper owner names instead of Gerrit User NNN
This change deletes the OwnerName method on GerritCL, since Gerrit's format for its NoteDB backing store changed to display "Gerrit User NNN" instead of the proper display name in the meta commit. Update golang/go#28663 Change-Id: Ifa64ca2b2694b17e888451582b9c63f3f37280a9 Reviewed-on: https://go-review.googlesource.com/c/148557 Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org>
This commit is contained in:
Родитель
6f12689aa1
Коммит
5df336cd7f
|
@ -71,7 +71,7 @@ func (s *server) handleReviews(t *template.Template, w http.ResponseWriter, r *h
|
|||
for _, p := range s.data.reviews.Projects {
|
||||
var cs []*change
|
||||
for _, c := range p.Changes {
|
||||
if c.OwnerName() == ownerFilter {
|
||||
if o := c.Owner(); o != nil && o.Name() == ownerFilter {
|
||||
cs = append(cs, c)
|
||||
totalChanges++
|
||||
}
|
||||
|
@ -115,6 +115,7 @@ func (s *server) updateReviewsData() {
|
|||
proj := &project{GerritProject: p}
|
||||
p.ForeachOpenCL(func(cl *maintner.GerritCL) error {
|
||||
if cl.WorkInProgress() ||
|
||||
cl.Owner() == nil ||
|
||||
strings.Contains(cl.Commit.Msg, "DO NOT REVIEW") ||
|
||||
strings.Contains(cl.Commit.Msg, "DO NOT SUBMIT") {
|
||||
return nil
|
||||
|
|
|
@ -66,7 +66,7 @@ header {
|
|||
{{range .Changes}}
|
||||
<div class="row">
|
||||
<div class="date">{{.FormattedLastUpdate}}</div>
|
||||
<a class="owner" href="?owner={{.OwnerName}}">{{.OwnerName}}</a>
|
||||
<a class="owner" href="?owner={{.Owner.Name}}">{{.Owner.Name}}</a>
|
||||
<span class="change">
|
||||
<a href="https://{{$p.ReviewServer}}/{{.Number}}" target="_blank">{{.Number}}</a>
|
||||
{{.Subject}}
|
||||
|
|
|
@ -442,14 +442,6 @@ func (cl *GerritCL) Footer(key string) string {
|
|||
return v
|
||||
}
|
||||
|
||||
// OwnerName returns the name of the CL’s owner or an empty string on error.
|
||||
func (cl *GerritCL) OwnerName() string {
|
||||
if !cl.complete() {
|
||||
return ""
|
||||
}
|
||||
return cl.Metas[0].Commit.Author.Name()
|
||||
}
|
||||
|
||||
// OwnerID returns the ID of the CL’s owner. It will return -1 on error.
|
||||
func (cl *GerritCL) OwnerID() int {
|
||||
if !cl.complete() {
|
||||
|
|
|
@ -197,7 +197,7 @@ func TestGetGerritMessage(t *testing.T) {
|
|||
}
|
||||
}
|
||||
|
||||
func TestOwnerNameAndID(t *testing.T) {
|
||||
func TestOwnerID(t *testing.T) {
|
||||
cl := &GerritCL{}
|
||||
meta := newGerritMeta(
|
||||
&GitCommit{
|
||||
|
@ -212,20 +212,16 @@ func TestOwnerNameAndID(t *testing.T) {
|
|||
cl.Commit = &GitCommit{}
|
||||
|
||||
testCases := []struct {
|
||||
cl *GerritCL
|
||||
OwnerID int
|
||||
OwnerName string
|
||||
cl *GerritCL
|
||||
OwnerID int
|
||||
}{
|
||||
{&GerritCL{}, -1, ""},
|
||||
{cl, 137, "Rick Sanchez"},
|
||||
{&GerritCL{}, -1},
|
||||
{cl, 137},
|
||||
}
|
||||
for _, tc := range testCases {
|
||||
if got := tc.cl.OwnerID(); got != tc.OwnerID {
|
||||
t.Errorf("cl.OwnerID() = %d; want %d", got, tc.OwnerID)
|
||||
}
|
||||
if got := tc.cl.OwnerName(); got != tc.OwnerName {
|
||||
t.Errorf("cl.OwnerName() = %q; want %q", got, tc.OwnerName)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче