From 753ad6166d55d43c2c1b482a205fc14fa671f7fa Mon Sep 17 00:00:00 2001 From: Earlopain <14981592+Earlopain@users.noreply.github.com> Date: Fri, 13 Oct 2023 19:21:21 +0200 Subject: [PATCH] Fix linking to config pages for disabled scrapers Also makes navigating to these a 404 instead of erroring out. See https://github.com/Earlopain/reverser/commit/84ee8dc4d00eae03af59dcec8bf4f4bc070d6930#comments --- app/controllers/config_controller.rb | 1 + app/views/stats/index.html.erb | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/app/controllers/config_controller.rb b/app/controllers/config_controller.rb index d507e1c9..6ec57bed 100644 --- a/app/controllers/config_controller.rb +++ b/app/controllers/config_controller.rb @@ -6,6 +6,7 @@ def index def show @definition = Sites.from_enum(params[:id]) + raise ActiveRecord::RecordNotFound unless @definition end def modify diff --git a/app/views/stats/index.html.erb b/app/views/stats/index.html.erb index 92a36b9a..fe934bd4 100644 --- a/app/views/stats/index.html.erb +++ b/app/views/stats/index.html.erb @@ -16,7 +16,7 @@ <% entry = @counts[definition.site_type] || {} %> <% next unless definition.scraper? || entry["file_count"] %> - <%= link_to_if(definition.site_type != "manual", definition.display_name, config_path(definition.site_type)) %> + <%= link_to_if(definition.scraper?, definition.display_name, config_path(definition.site_type)) %> <%= link_to(entry["artist_count"] || 0, artists_path(search: { site_type: definition.site_type })) %> <%= link_to(entry["url_count"] || 0, artist_urls_path(search: { site_type: definition.site_type })) %> <%= link_to(entry["submission_count"] || 0, submission_files_path(search: { site_type: definition.site_type })) %>