dmitri.shuralyov.com/app/changes

Work on better display of review event+comment.
dmitshur committed 7 years ago commit df42c9cf05f88830fff5a974b1932504de589b7f
Showing partial commit. Full Commit
Collapse all
display.go
@@ -27,10 +27,12 @@ type timelineItem struct {

func (i timelineItem) TemplateName() string {
	switch i.TimelineItem.(type) {
	case changes.Comment:
		return "comment"
	case changes.Review:
		return "review"
	case changes.TimelineItem:
		return "event"
	default:
		panic(fmt.Errorf("unknown item type %T", i.TimelineItem))
	}
@@ -38,10 +40,12 @@ func (i timelineItem) TemplateName() string {

func (i timelineItem) CreatedAt() time.Time {
	switch i := i.TimelineItem.(type) {
	case changes.Comment:
		return i.CreatedAt
	case changes.Review:
		return i.CreatedAt
	case changes.TimelineItem:
		return i.CreatedAt
	default:
		panic(fmt.Errorf("unknown item type %T", i))
	}
@@ -49,10 +53,12 @@ func (i timelineItem) CreatedAt() time.Time {

func (i timelineItem) ID() uint64 {
	switch i := i.TimelineItem.(type) {
	case changes.Comment:
		return i.ID
	case changes.Review:
		return i.ID
	case changes.TimelineItem:
		return i.ID
	default:
		panic(fmt.Errorf("unknown item type %T", i))
	}