From 2dea596dbb31f3794744a1bd2c9ec6091d8dfdff Mon Sep 17 00:00:00 2001 From: Star Rauchenberger Date: Sat, 7 Dec 2024 21:22:22 -0500 Subject: Send webmentions when publishing/editing a blog post --- app/jobs/send_webmentions_job.rb | 13 +++++++++++++ 1 file changed, 13 insertions(+) create mode 100644 app/jobs/send_webmentions_job.rb (limited to 'app/jobs/send_webmentions_job.rb') 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 @@ +require 'webmention' + +class SendWebmentionsJob < ApplicationJob + queue_as :default + + def perform(blog) + source = Rails.application.routes.url_helpers.blog_url(blog, host: "www.fourisland.com") + urls = Webmention.mentioned_urls(source) + urls.each do |url| + Webmention.send_webmention(source, url) + end + end +end -- cgit 1.4.1