diff --git a/handlers/incident.go b/handlers/incident.go index 1b478dbb..b79ee21b 100644 --- a/handlers/incident.go +++ b/handlers/incident.go @@ -113,6 +113,7 @@ func apiIncidentUpdatesHandler(w http.ResponseWriter, r *http.Request) { sendErrorJson(err, w, r) return } + sortUpdates(incid.Updates) returnJson(incid.Updates, w, r) } diff --git a/types/incidents/database.go b/types/incidents/database.go index 3135c650..b38ae461 100644 --- a/types/incidents/database.go +++ b/types/incidents/database.go @@ -34,7 +34,7 @@ func (i *Incident) BeforeCreate() error { } func (i *Incident) AfterFind() { - db.Model(i).Related(i.Updates).Order("created_at DESC") + db.Model(i).Related(&i.Updates).Order("id DESC") metrics.Query("incident", "find") }