From f5d791c05e4b94a32efd2ee49ad304989e643080 Mon Sep 17 00:00:00 2001 From: Peter Stuifzand Date: Mon, 19 Feb 2018 21:32:30 +0100 Subject: [PATCH] Check is all items are published --- cmd/server/memory.go | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/cmd/server/memory.go b/cmd/server/memory.go index 06a99eb..c306bd9 100644 --- a/cmd/server/memory.go +++ b/cmd/server/memory.go @@ -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 strings.Compare(timeA, timeB) > 0 }) return microsub.Timeline{