@@ -300,27 +300,20 @@ func (h *handler) ChangeHandler(w http.ResponseWriter, req *http.Request, change
}
state.Change, err = h.is.Get(req.Context(), state.RepoSpec, state.ChangeID)
if err != nil {
return err
}
cs, err := h.is.ListComments(req.Context(), state.RepoSpec, state.ChangeID, nil)
ts, err := h.is.ListTimeline(req.Context(), state.RepoSpec, state.ChangeID, nil)
if err != nil {
return fmt.Errorf("changes.ListComments: %v", err)
return fmt.Errorf("changes.ListTimeline: %v", err)
}
es, err := h.is.ListEvents(req.Context(), state.RepoSpec, state.ChangeID, nil)
if err != nil {
return fmt.Errorf("changes.ListEvents: %v", err)
}
var items []timelineItem
for _, comment := range cs {
items = append(items, timelineItem{comment})
}
for _, event := range es {
items = append(items, timelineItem{event})
var timeline []timelineItem
for _, item := range ts {
timeline = append(timeline, timelineItem{item})
}
sort.Sort(byCreatedAtID(items))
state.Items = items
sort.Sort(byCreatedAtID(timeline))
state.Timeline = timeline
// Call loadTemplates to set updated reactionsBar, reactableID, etc., template functions.
t, err := loadTemplates(state.State, h.Options.BodyPre)
if err != nil {
return fmt.Errorf("loadTemplates: %v", err)
}
@@ -498,13 +491,13 @@ type state struct {
HeadPre, HeadPost template.HTML
BodyTop template.HTML
common.State
Changes component.Changes
Change changes.Change
Items []timelineItem
Changes component.Changes
Change changes.Change
Timeline []timelineItem
}
func (s state) Tabnav(selected string) template.HTML {
// Render the tabnav.
return template.HTML(htmlg.RenderComponentsString(tabnav{