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/models/blog.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'app/models/blog.rb') diff --git a/app/models/blog.rb b/app/models/blog.rb index 8599bcd..db05432 100644 --- a/app/models/blog.rb +++ b/app/models/blog.rb @@ -19,6 +19,7 @@ class Blog < ApplicationRecord before_validation :set_draft_title before_save :set_published_at + after_save :send_webmentions def path "/says/#{slug}" @@ -72,4 +73,10 @@ class Blog < ApplicationRecord self.published_at = nil end end + + def send_webmentions + return unless self.published + + SendWebmentionsJob.perform_later self + end end -- cgit 1.4.1