-
Notifications
You must be signed in to change notification settings - Fork 6
/
plugin.rb
26 lines (20 loc) · 814 Bytes
/
plugin.rb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# name: rss-poster
# about: Discourse plugin which creates posts from feeds
# version: 0.4
# authors: Leo McArdle
# url: https://github.com/LeoMcA/discourse-rss-poster
require 'sidekiq/api'
load File.expand_path('../lib/rss_poster.rb', __FILE__)
load File.expand_path('../lib/rss_poster/engine.rb', __FILE__)
register_asset 'stylesheets/rss_poster.scss'
after_initialize do
load File.expand_path('../jobs/rss_poster_poll.rb', __FILE__)
RssPoster::Feed.all.each do |feed|
Jobs.cancel_scheduled_job(:rss_poster_poll, feed_id: feed.id)
Jobs.enqueue_in(5.seconds, :rss_poster_poll, feed_id: feed.id)
end
end
add_admin_route 'rss_poster.title', 'rss-poster.feeds'
Discourse::Application.routes.append do
mount RssPoster::Engine => '/admin/plugins/rss-poster', constraints: StaffConstraint.new
end