From 52bc16436edce8754b70296a2bc647a0129c785d Mon Sep 17 00:00:00 2001 From: Peter Stuifzand Date: Sun, 19 Aug 2018 21:48:50 +0200 Subject: [PATCH] Change Summary from string to []string --- pkg/fetch/fetch.go | 4 ++-- pkg/jf2/simplify.go | 2 +- pkg/microsub/protocol.go | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/pkg/fetch/fetch.go b/pkg/fetch/fetch.go index 14eb6ba..5aeb46d 100644 --- a/pkg/fetch/fetch.go +++ b/pkg/fetch/fetch.go @@ -261,7 +261,7 @@ func FeedItems(fetcher Fetcher, fetchURL, contentType string, body io.Reader) ([ item.Content.HTML = feedItem.ContentHTML item.Content.Text = feedItem.ContentText item.URL = feedItem.URL - item.Summary = feedItem.Summary + item.Summary = append(item.Summary, feedItem.Summary) item.ID = hex.EncodeToString([]byte(feedItem.ID)) item.Published = feedItem.DatePublished @@ -304,7 +304,7 @@ func FeedItems(fetcher Fetcher, fetchURL, contentType string, body io.Reader) ([ if len(item.Content.HTML) == 0 { item.Content.HTML = feedItem.Summary } else { - item.Summary = feedItem.Summary + item.Summary = append(item.Summary, feedItem.Summary) } } item.URL = feedItem.Link diff --git a/pkg/jf2/simplify.go b/pkg/jf2/simplify.go index 4df30f9..7f91372 100644 --- a/pkg/jf2/simplify.go +++ b/pkg/jf2/simplify.go @@ -259,7 +259,7 @@ func MapToItem(result map[string]interface{}) microsub.Item { if summary, e := result["summary"]; e { if summaryString, ok := summary.(string); ok { - item.Summary = summaryString + item.Summary = append(item.Summary, summaryString) } } diff --git a/pkg/microsub/protocol.go b/pkg/microsub/protocol.go index 970d417..5d94dab 100644 --- a/pkg/microsub/protocol.go +++ b/pkg/microsub/protocol.go @@ -70,7 +70,7 @@ type Item struct { BookmarkOf []string `json:"bookmark-of,omitempty"` RepostOf []string `json:"repost-of,omitempty"` InReplyTo []string `json:"in-reply-to,omitempty"` - Summary string `json:"summary,omitempty"` + Summary []string `json:"summary,omitempty"` Content *Content `json:"content,omitempty"` Latitude string `json:"latitude,omitempty"` Longitude string `json:"longitude,omitempty"`