diff --git a/app/logical/missed_search_service.rb b/app/logical/missed_search_service.rb index e2f4ae5ba..6f8608787 100644 --- a/app/logical/missed_search_service.rb +++ b/app/logical/missed_search_service.rb @@ -1,5 +1,15 @@ # queries reportbooru to find missed post searches class MissedSearchService + def self.enabled? + Danbooru.config.reportbooru_server.present? + end + + def initialize + if !MissedSearchService.enabled? + raise NotImplementedError.new("the Reportbooru service isn't configured. Missed searches are not available.") + end + end + def each_search(&block) fetch_data.scan(/(.+?) (\d+)\.0\n/).each(&block) end diff --git a/app/logical/popular_search_service.rb b/app/logical/popular_search_service.rb index ac7e0c88c..cb1b84b53 100644 --- a/app/logical/popular_search_service.rb +++ b/app/logical/popular_search_service.rb @@ -2,7 +2,15 @@ class PopularSearchService attr_reader :date, :scale + def self.enabled? + Danbooru.config.reportbooru_server.present? + end + def initialize(date, scale) + if !PopularSearchService.enabled? + raise NotImplementedError.new("the Reportbooru service isn't configured. Popular searches are not available.") + end + @date = date @scale = scale end diff --git a/app/logical/reports/user_similarity.rb b/app/logical/reports/user_similarity.rb index 4560b1070..b2c6bfc45 100644 --- a/app/logical/reports/user_similarity.rb +++ b/app/logical/reports/user_similarity.rb @@ -24,7 +24,7 @@ module Reports end def fetch_similar_user_ids(endpoint = "user_similarity") - return NotImplementedError unless Danbooru.config.reportbooru_server + raise NotImplementedError.new("the Reportbooru service isn't configured. User similarity is not available.") unless Danbooru.config.reportbooru_server params = { "key" => Danbooru.config.reportbooru_key, diff --git a/app/views/posts/partials/common/_secondary_links.html.erb b/app/views/posts/partials/common/_secondary_links.html.erb index 97ddb9002..3eff9ecc7 100644 --- a/app/views/posts/partials/common/_secondary_links.html.erb +++ b/app/views/posts/partials/common/_secondary_links.html.erb @@ -4,7 +4,7 @@