Skip to content
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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

cavis
Copy link
Member

@cavis cavis commented May 9, 2024

Cleaning up and simplifying categories and keywords:

  • Make podcast.categories and episode.categories an array field
  • Port all existing categories/keywords to the new single field
  • Drop podcast.keywords and podcast.categories
  • Have the RSS importer combine incoming data into the single array field
  • Add a Categories field to the podcast settings form

image

@@ -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?)
Copy link
Member Author

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] || []
Copy link
Member Author

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?
Copy link
Member Author

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?

@cavis cavis self-assigned this May 9, 2024
@kookster kookster self-requested a review May 15, 2024 16:08
@cavis cavis mentioned this pull request May 15, 2024
6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant