diff --git a/app/controllers/admin/podcasts_controller.rb b/app/controllers/admin/podcasts_controller.rb index 733a247f5..1acad167f 100644 --- a/app/controllers/admin/podcasts_controller.rb +++ b/app/controllers/admin/podcasts_controller.rb @@ -47,8 +47,9 @@ module Admin def fetch limit = params[:limit].to_i.zero? ? nil : params[:limit].to_i - force = params[:force].to_i == 1 - Podcasts::GetEpisodesWorker.perform_async("podcast_id" => @podcast.id, "limit" => limit, "force" => force) + force_update = params[:force].to_i == 1 + Podcasts::GetEpisodesWorker.perform_async("podcast_id" => @podcast.id, "limit" => limit, + "force_update" => force_update) flash[:notice] = I18n.t("admin.podcasts_controller.scheduled", title: @podcast.title, id: @podcast.id) redirect_to admin_podcasts_path diff --git a/app/views/admin/podcasts/edit.html.erb b/app/views/admin/podcasts/edit.html.erb index 0cbbf91d8..66ab0b3c0 100644 --- a/app/views/admin/podcasts/edit.html.erb +++ b/app/views/admin/podcasts/edit.html.erb @@ -12,7 +12,7 @@ <%= text_field_tag :limit, 5, size: 2, class: "crayons-textfield w-25" %>
- <%= check_box_tag :force, {}, false, { class: "crayons-checkbox" } %> + <%= check_box_tag :force, 1, false, { class: "crayons-checkbox" } %> <%= label_tag :force, class: "crayons-field__label" do %> Force

When checked, the existing episodes' urls will be re-checked and episodes reachable and https fields will be updated accordingly if needed.

diff --git a/spec/requests/admin/podcasts_spec.rb b/spec/requests/admin/podcasts_spec.rb index 7e5151b0e..ac85088a1 100644 --- a/spec/requests/admin/podcasts_spec.rb +++ b/spec/requests/admin/podcasts_spec.rb @@ -105,14 +105,14 @@ RSpec.describe "/admin/content_manager/podcasts" do it "schedules a worker to fetch episodes" do sidekiq_assert_enqueued_with(job: Podcasts::GetEpisodesWorker, - args: [{ podcast_id: podcast.id, limit: 5, force: false }]) do + args: [{ podcast_id: podcast.id, limit: 5, force_update: false }]) do post fetch_admin_podcast_path(podcast.id), params: { limit: "5", force: nil } end end it "schedules a worker without limit and with force" do sidekiq_assert_enqueued_with(job: Podcasts::GetEpisodesWorker, - args: [{ podcast_id: podcast.id, force: true, limit: nil }]) do + args: [{ podcast_id: podcast.id, force_update: true, limit: nil }]) do post fetch_admin_podcast_path(podcast.id), params: { force: "1", limit: "" } end end