10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'app/controllers/source_monitor/source_favicon_fetches_controller.rb', line 10
def create
unless defined?(ActiveStorage) && SourceMonitor.config.favicons.enabled?
return render_fetch_enqueue_response("Favicon fetching is not enabled.", toast_level: :warning)
end
if @source.respond_to?(:favicon) && @source.favicon.attached?
@source.favicon.purge
end
@source.clear_favicon_cooldown!
SourceMonitor::FaviconFetchJob.perform_later(@source.id)
render_fetch_enqueue_response("Favicon fetch has been enqueued.")
rescue StandardError => error
handle_fetch_failure(error, prefix: "Favicon fetch")
end
|