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

component: Display Closer details for Closed events.

Similar to https://github.com/shurcooL/issuesapp/commit/3bc17d8bc061b5a11eb287a91e23ef5dfcc38ea4.

Follows https://dmitri.shuralyov.com/service/change/...$commit/5b675ebb0b2bc6dd93ba2cedf6b4c7c9e0271de1
and https://dmitri.shuralyov.com/html/belt/...$commit/f6fb90ff73e49d9904a6a8a5561e437734a2ea57.
dmitshur committed 6 years ago commit 9cde693896e2bf80d4652be880d278dc59a4772b
Collapse all
component/component.go
@@ -5,10 +5,11 @@ import (
	"fmt"
	"time"

	"dmitri.shuralyov.com/html/belt"
	"dmitri.shuralyov.com/service/change"
	"dmitri.shuralyov.com/state"
	"github.com/dustin/go-humanize"
	"github.com/shurcooL/htmlg"
	issuescomponent "github.com/shurcooL/issuesapp/component"
	"github.com/shurcooL/octiconssvg"
	"github.com/shurcooL/users"
@@ -99,11 +100,31 @@ func (e Event) icon() *html.Node {
}

func (e Event) text() []*html.Node {
	switch p := e.Event.Payload.(type) {
	case change.ClosedEvent:
		return []*html.Node{htmlg.Text("closed this")}
		ns := []*html.Node{htmlg.Text("closed this")}
		switch c := p.Closer.(type) {
		case change.Change:
			ns = append(ns, htmlg.Text(" in "))
			ns = append(ns, belt.Change{
				State:   state.Change(c.State), // TODO: Make the conversion go away (by making change.State type state.Change).
				Title:   c.Title,
				HTMLURL: p.CloserHTMLURL,
				Short:   true,
			}.Render()...)
		case change.Commit:
			ns = append(ns, htmlg.Text(" in "))
			ns = append(ns, belt.Commit{
				SHA:             c.SHA,
				Message:         c.Message,
				AuthorAvatarURL: c.Author.AvatarURL,
				HTMLURL:         p.CloserHTMLURL,
				Short:           true,
			}.Render()...)
		}
		return ns
	case change.ReopenedEvent:
		return []*html.Node{htmlg.Text("reopened this")}
	case change.RenamedEvent:
		return []*html.Node{htmlg.Text("changed the title from "), htmlg.Strong(p.From), htmlg.Text(" to "), htmlg.Strong(p.To)}
	case change.LabeledEvent: