Check is all items are published

This commit is contained in:
Peter Stuifzand 2018-02-19 21:32:30 +01:00
parent 062e60ee81
commit f5d791c05e

View File

@ -155,17 +155,19 @@ func (b *memoryBackend) TimelineGet(after, before, channel string) microsub.Time
}
}
items = append(items, results...)
// Filter items with "published" date
for _, r := range results {
if p, e := r["published"]; e {
items = append(items, r)
}
}
}
}
sort.Slice(items, func(a, b int) bool {
timeA, okA := items[a]["published"].(string)
timeB, okB := items[b]["published"].(string)
if okA && okB {
return strings.Compare(timeA, timeB) > 0
}
return false
})
return microsub.Timeline{