rss: continue to sort results by pubdate desc

This commit is contained in:
James Bayliss
2021-02-16 19:35:21 +00:00
parent 4476094add
commit 9c8977a474

View File

@@ -5,6 +5,7 @@ import (
"fmt"
"github.com/l3uddz/nabarr/media"
"github.com/lucperkins/rek"
"sort"
"strings"
"time"
)
@@ -71,6 +72,11 @@ func (j *rssJob) getFeed() ([]media.FeedItem, error) {
return items, nil
}
// sort response items
sort.SliceStable(b.Channel.Items, func(i, j int) bool {
return b.Channel.Items[i].PubDate.After(b.Channel.Items[j].PubDate.Time)
})
// process feed items
for p, i := range b.Channel.Items {
// ignore items