New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Combine categories and keywords #1018
base: main
Are you sure you want to change the base?
Conversation
@@ -22,4 +22,16 @@ def sanitize_text_only(text) | |||
return nil if text.blank? | |||
Loofah.fragment(text).scrub!(:prune).text(encode_special_chars: false) | |||
end | |||
|
|||
def sanitize_keywords(kws, strict) | |||
Array(kws).map { |kw| sanitize_keyword(kw, kw.length, strict) }.uniq.reject(&:blank?) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Combining a bunch of logic from elsewhere.
This takes in any input, and returns an array of unique/stripped/non-blank strings.
Optionally with strict
, it applies our lowercasing/only-allowed-chars logic. Which is used for episode.keyword_xid
and matching feed.include_tags
/ feed.exclude_tags
.
@@ -224,15 +222,11 @@ def overrides | |||
end | |||
|
|||
def categories | |||
self[:categories] ||= [] | |||
self[:categories] || [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I opted to leave this postgres array field nil in the database, instead of an empty array. Assuming it's up to the SQL-er to check for NOT NULL
when I get around to querying on this.
@@ -82,11 +82,11 @@ xml.rss "xmlns:atom" => "http://www.w3.org/2005/Atom", | |||
xml.itunes(:summary) { xml.cdata!(itunes_summary(@podcast)) } | |||
end | |||
|
|||
xml.itunes :keywords, @podcast.keywords.join(",") unless @podcast.keywords.blank? | |||
# xml.itunes :keywords, @podcast.keywords.join(",") unless @podcast.keywords.blank? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TODO: do we want to keep rendering these fields - maybe with strict-sanitized (lowercased etc) content?
Or do we just drop support, since they seem deprecated anyways?
Cleaning up and simplifying categories and keywords:
podcast.categories
andepisode.categories
an array fieldpodcast.keywords
andpodcast.categories