aboutsummaryrefslogtreecommitdiff
path: root/internal/feed/item.go
diff options
context:
space:
mode:
authorRené 'Necoro' Neumann <necoro@necoro.eu>2020-05-06 22:56:38 +0200
committerRené 'Necoro' Neumann <necoro@necoro.eu>2020-05-06 22:56:38 +0200
commite0a857eafebd92d5e94d156997d5d9422a50933f (patch)
tree4430fd19b59f05f82637bb45924009ab36b6c349 /internal/feed/item.go
parent9125f573c96001df5e4c76fd2183a9d368a552ab (diff)
downloadfeed2imap-go-e0a857eafebd92d5e94d156997d5d9422a50933f.tar.gz
feed2imap-go-e0a857eafebd92d5e94d156997d5d9422a50933f.tar.bz2
feed2imap-go-e0a857eafebd92d5e94d156997d5d9422a50933f.zip
Improve template
Diffstat (limited to 'internal/feed/item.go')
-rw-r--r--internal/feed/item.go16
1 files changed, 12 insertions, 4 deletions
diff --git a/internal/feed/item.go b/internal/feed/item.go
index b8fb7f7..bbf7668 100644
--- a/internal/feed/item.go
+++ b/internal/feed/item.go
@@ -17,8 +17,8 @@ type feedImage struct {
}
type item struct {
- *gofeed.Feed
*gofeed.Item
+ Feed *gofeed.Feed
feed *Feed
Body string
updateOnly bool
@@ -28,14 +28,22 @@ type item struct {
}
// Creator returns the name of the creating author.
-// MUST NOT have `*item` has the receiver, because the template breaks then.
func (item *item) Creator() string {
- if item.Item.Author != nil {
- return item.Item.Author.Name
+ if item.Author != nil {
+ return item.Author.Name
}
return ""
}
+func (item *item) FeedLink() string {
+ if item.Feed.Link != "" {
+ // the one in the feed itself
+ return item.Feed.FeedLink
+ }
+ // the one in the config
+ return item.feed.Url
+}
+
func (item *item) addReason(reason string) {
if !util.StrContains(item.reasons, reason) {
item.reasons = append(item.reasons, reason)