[deploy] return fields needed to populate the view for podcast episodes (#6986)

This commit is contained in:
Molly Struve 2020-04-02 09:21:25 -05:00 committed by GitHub
parent 4208efd6b6
commit bdd4e59f0f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 7 deletions

View file

@ -29,6 +29,11 @@ module Search
source["user_id"] = source.dig("user", "id")
source["highlight"] = hit["highlight"]
source["readable_publish_date"] = source["readable_publish_date_string"]
source["podcast"] = {
"slug" => source["slug"],
"image_url" => source["main_image"],
"title" => source["title"]
}
source.merge(timestamps_hash(hit))
end

View file

@ -39,17 +39,19 @@ module Search
SOURCE = %i[
id
title
path
class_name
comments_count
tags
readable_publish_date_string
positive_reactions_count
flare_tag_hash
user
reading_time
main_image
path
positive_reactions_count
published_at
readable_publish_date_string
reading_time
slug
tags
title
user
].freeze
attr_accessor :params, :body

View file

@ -38,12 +38,14 @@ RSpec.describe Search::FeedContent, type: :service do
]
flare_tag_keys = %w[name bg_color_hex text_color_hex]
user_keys = %w[username name profile_image_90]
podcast_keys = %w[slug image_url title]
index_documents([article1])
feed_doc = described_class.search_documents(params: { size: 1 }).first
expect(feed_doc.keys).to include(*view_keys)
expect(feed_doc["user"].keys).to include(*user_keys)
expect(feed_doc["flare_tag"].keys).to include(*flare_tag_keys)
expect(feed_doc["podcast"].keys).to include(*podcast_keys)
end
context "with a query" do