about summary refs log tree commit diff stats
path: root/app/jobs
diff options
context:
space:
mode:
authorStar Rauchenberger <fefferburbia@gmail.com>2024-12-07 21:22:22 -0500
committerStar Rauchenberger <fefferburbia@gmail.com>2024-12-07 21:22:22 -0500
commit2dea596dbb31f3794744a1bd2c9ec6091d8dfdff (patch)
treeb10639a2cd1f452da72a59503ac16ca8236c5093 /app/jobs
parent9d8deddb0a9df7d4d7d4b649ddf01b15570719e0 (diff)
downloadthoughts-2dea596dbb31f3794744a1bd2c9ec6091d8dfdff.tar.gz
thoughts-2dea596dbb31f3794744a1bd2c9ec6091d8dfdff.tar.bz2
thoughts-2dea596dbb31f3794744a1bd2c9ec6091d8dfdff.zip
Send webmentions when publishing/editing a blog post
Diffstat (limited to 'app/jobs')
-rw-r--r--app/jobs/send_webmentions_job.rb13
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 @@
1require 'webmention'
2
3class 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
13end