From 8d978ffaf194cc875895d2c1e784b56b06ac7cfd Mon Sep 17 00:00:00 2001 From: Umputun Date: Sun, 6 Jan 2019 15:31:29 -0600 Subject: [PATCH] add post title to rss item --- backend/app/rest/api/rss.go | 4 ++++ backend/app/store/service/service_test.go | 2 +- 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/backend/app/rest/api/rss.go b/backend/app/rest/api/rss.go index 003337bb..98ff4e12 100644 --- a/backend/app/rest/api/rss.go +++ b/backend/app/rest/api/rss.go @@ -175,6 +175,10 @@ func (s *Rest) toRssFeed(url string, comments []store.Comment) (string, error) { log.Printf("[WARN] failed to get info about parent comment, %s", err) } } + if c.PostTitle != "" { + f.Title = f.Title + ", " + c.PostTitle + } + feed.Items = append(feed.Items, &f) if i > maxRssItems { break diff --git a/backend/app/store/service/service_test.go b/backend/app/store/service/service_test.go index f4292ba9..609e53f9 100644 --- a/backend/app/store/service/service_test.go +++ b/backend/app/store/service/service_test.go @@ -94,7 +94,7 @@ func TestService_CreateFromPartialWithTitle(t *testing.T) { res, err := b.Get(store.Locator{URL: "https://radio-t.com/p/2018/12/29/podcast-630/", SiteID: "radio-t"}, id) assert.NoError(t, err) t.Logf("%+v", res) - assert.Equal(t, "Радио-Т 630 - Радио-Т Подкаст", res.PostTitle) + assert.Equal(t, "Радио-Т 630", res.PostTitle) comment.PostTitle = "post blah" id, err = b.Create(comment)