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

Add initial support for merged event.
dmitshur committed 7 years ago commit 60e617729e919171adab019f0e00ca6e6eb58c49
Collapse all
component/component.go
@@ -66,10 +66,13 @@ func (e Event) icon() *html.Node {
		icon = octiconssvg.X()
	case "ReviewRequestedEvent":
		icon = octiconssvg.Eye()
	case "ReviewRequestRemovedEvent":
		icon = octiconssvg.X()
	case "MergedEvent":
		icon = octiconssvg.GitMerge()
		color, backgroundColor = "#fff", "#6f42c1"
	case "ApprovedEvent":
		icon = octiconssvg.Check()
		color, backgroundColor = "#fff", "#6cc644"
	default:
		icon = octiconssvg.PrimitiveDot()
@@ -112,10 +115,17 @@ func (e Event) text() []*html.Node {
	case "ReviewRequestRemovedEvent":
		ns := []*html.Node{htmlg.Text("removed the review request from ")}
		ns = append(ns, Avatar{User: e.Event.RequestedReviewer, Size: 16, Inline: true}.Render()...)
		ns = append(ns, User{e.Event.RequestedReviewer}.Render()...)
		return ns
	case "MergedEvent":
		var ns []*html.Node
		ns = append(ns, htmlg.Text("merged commit "))
		ns = append(ns, htmlg.Strong("d34db33f")) // TODO: e.MergedEvent.CommitID.
		ns = append(ns, htmlg.Text(" into "))
		ns = append(ns, htmlg.Strong("master")) // TODO: e.MergedEvent.RefName.
		return ns
	case "ApprovedEvent":
		return []*html.Node{htmlg.Text("approved these changes")}
	default:
		return []*html.Node{htmlg.Text(string(e.Event.Type))}
	}