dmitri.shuralyov.com/app/changes/...

component: When user login is missing, show name.

Follows https://dmitri.shuralyov.com/service/change/...$commit/0493202ef5f73b299291d6aa0ad2f5338c197e46.
dmitshur committed 6 years ago commit 07ddaaabd263e43af99a7f8085644b81ed900daa
Collapse all
component/component.go
@@ -270,10 +270,13 @@ type User struct {
}

func (u User) Render() []*html.Node {
	// TODO: Make this much nicer.
	// <a class="black" href="{{.HTMLURL}}"><strong>{{.Login}}</strong></a>
	if u.User.Login == "" {
		return []*html.Node{htmlg.Text(u.User.Name)}
	}
	a := &html.Node{
		Type: html.ElementNode, Data: atom.A.String(),
		Attr: []html.Attribute{
			{Key: atom.Class.String(), Val: "black"},
			{Key: atom.Href.String(), Val: u.User.HTMLURL},