diff options
Diffstat (limited to 'app/jobs')
| -rw-r--r-- | app/jobs/send_webmentions_job.rb | 13 |
1 files changed, 13 insertions, 0 deletions
| diff --git a/app/jobs/send_webmentions_job.rb b/app/jobs/send_webmentions_job.rb new file mode 100644 index 0000000..359f5b6 --- /dev/null +++ b/app/jobs/send_webmentions_job.rb | |||
| @@ -0,0 +1,13 @@ | |||
| 1 | require 'webmention' | ||
| 2 | |||
| 3 | class SendWebmentionsJob < ApplicationJob | ||
| 4 | queue_as :default | ||
| 5 | |||
| 6 | def perform(blog) | ||
| 7 | source = Rails.application.routes.url_helpers.blog_url(blog, host: "www.fourisland.com") | ||
| 8 | urls = Webmention.mentioned_urls(source) | ||
| 9 | urls.each do |url| | ||
| 10 | Webmention.send_webmention(source, url) | ||
| 11 | end | ||
| 12 | end | ||
| 13 | end | ||
