Skip to content

Commit

Permalink
Add option to exclude podcast metadata during import
Browse files Browse the repository at this point in the history
  • Loading branch information
radical-ube committed Aug 16, 2023
1 parent 4a572b0 commit 8584caf
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 7 deletions.
2 changes: 1 addition & 1 deletion app/controllers/imports_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ def create

respond_to do |format|
if @import.save
@import.import_later
@import.import_later(ActiveRecord::Type::Boolean.new.cast(params[:podcast_import][:import_metadata]))
format.html { redirect_to podcast_import_path(@podcast, @import), notice: t(".success") }
else
format.html do
Expand Down
6 changes: 1 addition & 5 deletions app/models/podcast_import.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class PodcastImport < ApplicationRecord

serialize :config, HashSerializer

attr_accessor :feed, :feed_raw_doc, :templates, :feed_source
attr_accessor :feed, :feed_raw_doc, :templates, :feed_source, :import_metadata

belongs_to :podcast, -> { with_deleted }, touch: true, optional: true, autosave: true
has_many :episode_imports, -> { where(has_duplicate_guid: false).includes(:podcast_import) }, dependent: :destroy
Expand Down Expand Up @@ -114,10 +114,6 @@ def import_episodes!
# Request the RSS feed again
get_feed

# Update podcast attributes
create_or_update_podcast!
status_created!

# Create the episodes
create_or_update_episode_imports!
status_importing!
Expand Down
8 changes: 7 additions & 1 deletion app/views/imports/_form_status.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<button type="button" class="prx-btn-help" data-bs-toggle="popover" data-bs-content="<%= "help" %>"><span class="material-icons">help</span></button>
</div>

<div class="col-12 mb-4 prx-field-group">
<div class="col-12 prx-field-group">
<div class="form-floating">
<%= form.text_field :url %>
<%= form.label :url, required: true %>
Expand All @@ -22,6 +22,12 @@
<button type="button" class="prx-btn-help" data-bs-toggle="popover" data-bs-content="<%= "help" %>"><span class="material-icons">help</span></button>
</div>

<div class="col-12 prx-field-group">
<div class="form-check">
<%= form.check_box :import_metadata, checked: true %>
<%= form.label :import_metadata, "Import podcast metadata" %>
</div>
</div>
</div>

<div class="card-footer d-flex-align-items-center justify-content-between">
Expand Down

0 comments on commit 8584caf

Please sign in to comment.