Fix force params of the fetch episodes (#18932)
* Fix force params of the fetch episodes * Fix rubocop@Fix force params of the fetch episodes --------- Co-authored-by: Joshua Wehner <joshua@forem.com>
This commit is contained in:
parent
d65b97ee34
commit
8e0b5bc0f5
3 changed files with 6 additions and 5 deletions
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -12,7 +12,7 @@
|
|||
<%= text_field_tag :limit, 5, size: 2, class: "crayons-textfield w-25" %>
|
||||
</div>
|
||||
<div class="crayons-field crayons-field--checkbox">
|
||||
<%= 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
|
||||
<p class="crayons-field__description">When checked, the existing episodes' urls will be re-checked and episodes reachable and https fields will be updated accordingly if needed.</p>
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue