diff --git a/app/controllers/internal/podcasts_controller.rb b/app/controllers/internal/podcasts_controller.rb index 502989eb8..77cc5548f 100644 --- a/app/controllers/internal/podcasts_controller.rb +++ b/app/controllers/internal/podcasts_controller.rb @@ -1,7 +1,7 @@ class Internal::PodcastsController < Internal::ApplicationController layout "internal" - before_action :find_podcast, only: %i[edit update remove_admin add_admin] + before_action :find_podcast, only: %i[edit update fetch remove_admin add_admin] before_action :find_user, only: %i[remove_admin add_admin] def index @@ -22,6 +22,14 @@ class Internal::PodcastsController < Internal::ApplicationController end end + 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) + flash[:notice] = "Podcast's episodes fetching was scheduled (#{@podcast.title}, ##{@podcast.id})" + redirect_to internal_podcasts_path + end + def remove_admin removed_roles = @user.remove_role(:podcast_admin, @podcast) if removed_roles.empty? diff --git a/app/views/internal/podcasts/edit.html.erb b/app/views/internal/podcasts/edit.html.erb index 7e9e2d80a..35d929404 100644 --- a/app/views/internal/podcasts/edit.html.erb +++ b/app/views/internal/podcasts/edit.html.erb @@ -1,12 +1,33 @@ +