0
0
Fork 0
mirror of https://github.com/discourse/discourse.git synced 2026-08-06 13:08:40 +08:00
discourse/plugins/discourse-rss-polling/config/routes.rb
Régis Hanol 4fc1144521
UX: Redesign the RSS Polling admin interface (#40790)
Previously, the RSS Polling plugin's admin page predated Discourse's
admin interface guidelines: it was a single inline-editable table with
no breadcrumbs or page header, it truncated long feed URLs, it required
horizontal scrolling on mobile, and it gave admins no way to verify a
feed before saving it.

This change rebuilds the page on the standard plugin "show route"
structure (breadcrumbs, page header, and Settings + Feeds tabs) with a
`d-table` feed list and dedicated FormKit new/edit routes, so the UI now
matches the rest of the admin interface and works on mobile. It also:

- Adds a **Test feed** dry-run that fetches a feed and previews which
items would be imported or skipped, with plain-language reasons, so
admins can validate a feed (and fix setup errors) before saving it.
- Adds the `rss_polling_feed_request_timeout` and
`rss_polling_verbose_logging` site settings.
- Extracts the fetch/parse and import/skip logic into `FeedFetcher` and
`FeedAnalyzer`, shared by the poll job and the new preview so the
dry-run and the real import always agree.
- Normalizes feed dates and categories so Atom feeds (which use
`<updated>` and `term`-style `<category>` elements) are handled like
RSS, and returns a clean error instead of a 500 when a feed cannot be
read.

---------

Co-authored-by: Martin Brennan <martin@discourse.org>
2026-07-02 07:40:25 +02:00

20 lines
1 KiB
Ruby
Vendored

# frozen_string_literal: true
DiscourseRssPolling::Engine.routes.draw do
post "feed_settings/test" => "feed_settings#test", :constraints => StaffConstraint.new
get "feed_settings/category_requirements" => "feed_settings#category_requirements",
:constraints => StaffConstraint.new
get "feed_settings/:id/history" => "feed_settings#history", :constraints => StaffConstraint.new
put "feed_settings/:id/enabled" => "feed_settings#set_enabled",
:constraints => StaffConstraint.new
post "feed_settings/:id/poll" => "feed_settings#poll", :constraints => StaffConstraint.new
delete "feed_settings/:id" => "feed_settings#destroy", :constraints => StaffConstraint.new
get "feed_settings/:id" => "feed_settings#feed", :constraints => StaffConstraint.new
resource :feed_settings, constraints: StaffConstraint.new, only: %i[show update]
end
Discourse::Application.routes.draw do
scope "/admin/plugins/discourse-rss-polling", constraints: StaffConstraint.new do
get "/feeds(/*path)" => "discourse_rss_polling/feed_settings#index"
end
end